From 46956f06708435826348eb482c67be5d17fbe705 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 21 May 2003 14:41:02 +0000 Subject: [PATCH] Don't forget that strlen() doesn't include the ending NUL. PR: 618 --- crypto/rand/rand_egd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- 2.25.1