Don't forget that strlen() doesn't include the ending NUL.
PR: 618
This commit is contained in:
parent
528c1ad2ae
commit
46956f0670
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue