Use the caculated length instead of maximum length.
This commit is contained in:
parent
b6f96462ba
commit
bf3a36cc7b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226079
@ -166,11 +166,11 @@ linux_getsockaddr(struct sockaddr **sap, const struct osockaddr *osa, int salen)
|
||||
namelen = strnlen(name + 1, salen - hdrlen - 1) + 1;
|
||||
} else
|
||||
namelen = strnlen(name, salen - hdrlen);
|
||||
if (hdrlen + namelen > sizeof(struct sockaddr_un)) {
|
||||
salen = hdrlen + namelen;
|
||||
if (salen > sizeof(struct sockaddr_un)) {
|
||||
error = ENAMETOOLONG;
|
||||
goto out;
|
||||
}
|
||||
salen = sizeof(struct sockaddr_un);
|
||||
}
|
||||
|
||||
sa = (struct sockaddr *)kosa;
|
||||
|
Loading…
Reference in New Issue
Block a user