mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-05 17:28:02 +00:00
socket sendto: gracefully handle 'size' not fitting into an u16_t (return EMSGSIZE error) see task #14378
This commit is contained in:
parent
5c33efe430
commit
4dd378b126
@ -1285,8 +1285,12 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
|
||||
#endif /* LWIP_TCP */
|
||||
}
|
||||
|
||||
/* @todo: split into multiple sendto's? */
|
||||
LWIP_ASSERT("lwip_sendto: size must fit in u16_t", size <= 0xffff);
|
||||
if (size > 0xFFFF) {
|
||||
/* cannot fit into one datagram (at least for us) */
|
||||
sock_set_errno(sock, EMSGSIZE);
|
||||
done_socket(sock);
|
||||
return -1;
|
||||
}
|
||||
short_size = (u16_t)size;
|
||||
LWIP_ERROR("lwip_sendto: invalid address", (((to == NULL) && (tolen == 0)) ||
|
||||
(IS_SOCK_ADDR_LEN_VALID(tolen) &&
|
||||
|
Loading…
Reference in New Issue
Block a user