pkarashchenko commented on code in PR #7912: URL: https://github.com/apache/nuttx/pull/7912#discussion_r1051587831
########## net/local/local_bind.c: ########## @@ -55,46 +55,44 @@ int psock_local_bind(FAR struct socket *psock, int 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)) + { + return -EINVAL; + } conn = (FAR struct local_conn_s *)psock->s_conn; /* Save the address family */ conn->lc_proto = psock->s_type; + conn->lc_instance_id = -1; /* Now determine the type of the Unix domain socket by comparing the size * of the address description. */ - if (addrlen == sizeof(sa_family_t)) + namelen = strnlen(unaddr->sun_path, UNIX_PATH_MAX - 1); + if (namelen <= 0) Review Comment: ```suggestion 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