casaroli commented on code in PR #21528:
URL: https://github.com/apache/nuttx/pull/21528#discussion_r4501769561


##########
net/tcp/tcp_recvfrom.c:
##########
@@ -879,10 +880,24 @@ ssize_t psock_tcp_recvfrom(FAR struct socket *psock, FAR 
struct msghdr *msg,
   FAR struct sockaddr   *from    = msg->msg_name;
   FAR socklen_t         *fromlen = &msg->msg_namelen;
   FAR struct tcp_conn_s *conn;
+  size_t                 total   = 0;
   ssize_t                nrecv   = 0;
   ssize_t                ret     = 0;
   int                    i;
 
+  /* The sum of the iov_len values must fit in an ssize_t */
+
+  for (i = 0; i < msg->msg_iovlen; i++)

Review Comment:
   psock_tcp_recvfrom() has one caller, inet_recvmsg() (inet_sockif.c:2241), 
and this PR adds the same check there. This loop can never fail.
   Fix: remove this loop, `total`, the `<limits.h>` include and the include 
reorder from tcp_recvfrom.c.



-- 
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]

Reply via email to