Board logo

标题: 数组溢出 Array out of bounds [打印本页]

作者: look_w    时间: 2017-10-24 17:59     标题: 数组溢出 Array out of bounds

数组溢出:


error: Array 'g_sAccepChannelBusiness[200]' accessed at index 254, which is out of bounds.





1.


#define
MAX_TCPSERVERCONNECT
200


#define
MAX_TCPCLIENTCONNECT
200




struct
SChannelBusiness
g_sAccepChannelBusiness[MAX_TCPSERVERCONNECT];









int
u4ip = i;







if ((g_sParkingInfo.au4Ip[u4ip & 0xff] & 0xff) != 0)







{








if (iPrintfFlag == 1)









_printf("FD_SET gAccept_fd[%03d] socket=%05d %s CAN hearbeat YES ", i, ifdTmp, (char*)(inet_ntoa(g_sAccepChannelBusiness[i].gAccept_addr.sin_addr)));







}

修改:

#define
MAX_TCPSERVERCONNECT
255


#define
MAX_TCPCLIENTCONNECT
255




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0