netlib_getarptab: fix codechecker high level issue
197: paysize = RTA_PAYLOAD(&resp->attr); 198: if (paysize > maxsize) 199: { 200: paysize = maxsize; 201: } 202: 203: memcpy(arptab, resp->data, paysize); Memory copy function accesses out-of-bound array element Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
6fb173e3d5
commit
cfb64cffb1
@ -99,7 +99,7 @@ ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab,
|
||||
|
||||
/* Pre-allocate a buffer to hold the response */
|
||||
|
||||
maxsize = CONFIG_NET_ARPTAB_SIZE * sizeof(struct arp_entry_s);
|
||||
maxsize = nentries * sizeof(struct arp_entry_s);
|
||||
allocsize = SIZEOF_NETLIB_RECVFROM_RESPONSE_S(maxsize);
|
||||
resp = (FAR struct netlib_recvfrom_response_s *)malloc(allocsize);
|
||||
if (resp == NULL)
|
||||
|
Loading…
x
Reference in New Issue
Block a user