pkarashchenko commented on code in PR #7912:
URL: https://github.com/apache/nuttx/pull/7912#discussion_r1051589090


##########
net/local/local_bind.c:
##########
@@ -52,49 +52,47 @@ int psock_local_bind(FAR struct socket *psock,
   FAR struct local_conn_s *conn;
   FAR const struct sockaddr_un *unaddr =
     (FAR const struct sockaddr_un *)addr;
-  int namelen;
+  size_t namelen;
 
   DEBUGASSERT(psock != NULL && psock->s_conn != NULL &&
-              unaddr != NULL && unaddr->sun_family == AF_LOCAL &&
-              addrlen >= sizeof(sa_family_t));
+              unaddr != NULL && unaddr->sun_family == AF_LOCAL);
+
+  if (addrlen <= sizeof(sa_family_t) + 1)

Review Comment:
   Let's change to
   ```suggestion
     if (addrlen <= sizeof(sa_family_t) + 2)
   ```
   as it seems to be more correct since `unaddr->sun_path[1]` is accessed in 
`namelen == 0` case and `unaddr->sun_path` will contain at least 2 chars (1 non 
`'\0'` and one `'\0'`) if `namelen != 0`



-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to