Don't forget that strlen() doesn't include the ending NUL.

PR: 618
This commit is contained in:
Richard Levitte 2003-05-21 14:41:02 +00:00
parent 528c1ad2ae
commit 46956f0670

View file

@ -102,7 +102,7 @@ int RAND_egd(const char *path)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (strlen(path) > sizeof(addr.sun_path))
if (strlen(path) >= sizeof(addr.sun_path))
return (-1);
strcpy(addr.sun_path,path);
len = offsetof(struct sockaddr_un, sun_path) + strlen(path);
@ -134,7 +134,7 @@ int RAND_egd_bytes(const char *path,int bytes)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (strlen(path) > sizeof(addr.sun_path))
if (strlen(path) >= sizeof(addr.sun_path))
return (-1);
strcpy(addr.sun_path,path);
len = offsetof(struct sockaddr_un, sun_path) + strlen(path);