From: Richard Levitte Date: Wed, 21 May 2003 14:41:02 +0000 (+0000) Subject: Don't forget that strlen() doesn't include the ending NUL. X-Git-Tag: OpenSSL_0_9_6k~30 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=46956f06708435826348eb482c67be5d17fbe705;p=oweals%2Fopenssl.git Don't forget that strlen() doesn't include the ending NUL. PR: 618 --- diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c index ce16936785..62229d97da 100644 --- a/crypto/rand/rand_egd.c +++ b/crypto/rand/rand_egd.c @@ -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);