Swatantra-66 commented on code in PR #21434:
URL: https://github.com/apache/nuttx/pull/21434#discussion_r4469852230
##########
net/usrsock/usrsock_sendmsg.c:
##########
@@ -160,12 +162,16 @@ static int do_sendto_request(FAR struct usrsock_conn_s
*conn,
for (i = 0; i < msg->msg_iovlen; i++)
{
- req.buflen += msg->msg_iov[i].iov_len;
- }
+ /* The sum of the iov_len values must fit in ssize_t and uint32_t */
- if (req.buflen > UINT32_MAX)
- {
- req.buflen = UINT32_MAX;
+ if (msg->msg_iov[i].iov_len >
+ (size_t)MIN(SSIZE_MAX, UINT32_MAX) - req.buflen)
Review Comment:
removed the cast
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]