1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-05 05:22:47 -05:00

Properly check the lengths of Unix-socket pathnames.

If something is too long to fit in a sun_addr, we should spot that
well in advance and not try.
This commit is contained in:
Simon Tatham
2017-02-14 21:59:52 +00:00
parent a146ab2e7a
commit bec33b2311
2 changed files with 4 additions and 3 deletions

View File

@ -1620,7 +1620,8 @@ SockAddr unix_sock_addr(const char *path)
if (n < 0)
ret->error = "snprintf failed";
else if (n >= sizeof ret->hostname)
else if (n >= sizeof ret->hostname ||
n >= sizeof(((struct sockaddr_un *)0)->sun_path))
ret->error = "socket pathname too long";
#ifndef NO_IPV6