gracefully handle invalid addrlen value in recvfrom
This commit is contained in:
@@ -326,7 +326,10 @@ int (*realclose)(CLOSE_SIG);
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(n > 0) {
|
if(n > 0) {
|
||||||
// TODO: case for address size mismatch?
|
// For cases where *addrlen is an unreasonable value
|
||||||
|
// FIXME: This should probably have some more thought put into it
|
||||||
|
*addrlen = *addrlen > SDK_MTU ? 0 : *addrlen;
|
||||||
|
|
||||||
memcpy(addr, tmpbuf, *addrlen);
|
memcpy(addr, tmpbuf, *addrlen);
|
||||||
memcpy(&tmpsz, tmpbuf + sizeof(struct sockaddr_storage), sizeof(tmpsz));
|
memcpy(&tmpsz, tmpbuf + sizeof(struct sockaddr_storage), sizeof(tmpsz));
|
||||||
memcpy(&pnum, tmpbuf + sizeof(struct sockaddr_storage) + sizeof(int), sizeof(int));
|
memcpy(&pnum, tmpbuf + sizeof(struct sockaddr_storage) + sizeof(int), sizeof(int));
|
||||||
|
|||||||
Reference in New Issue
Block a user