Use the caculated length instead of maximum length.

This commit is contained in:
jkim 2011-10-06 21:55:05 +00:00
parent 5bf71ef7d8
commit f3e29d5483

View File

@ -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;