From ff8efdd42a4336723282416a5045bae7c8b32c8a Mon Sep 17 00:00:00 2001 From: beck <> Date: Fri, 12 Jan 2001 18:15:59 +0000 Subject: make sure s always has enough from for trailing \0. even though strlcpy will truncate, thanks to itojun@ --- src/lib/libcrypto/rand/randfile.c | 2 +- src/lib/libssl/src/crypto/rand/randfile.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/libcrypto/rand/randfile.c b/src/lib/libcrypto/rand/randfile.c index 8e993360fa..663a36cb70 100644 --- a/src/lib/libcrypto/rand/randfile.c +++ b/src/lib/libcrypto/rand/randfile.c @@ -221,7 +221,7 @@ const char *RAND_file_name(char *buf, int size) if (issetugid() == 0) s = getenv("RANDFILE"); - if (s != NULL && *s && strlen(s) < size) + if (s != NULL && *s && strlen(s) + 1 < size) { strlcpy(buf,s,size); ret=buf; diff --git a/src/lib/libssl/src/crypto/rand/randfile.c b/src/lib/libssl/src/crypto/rand/randfile.c index 8e993360fa..663a36cb70 100644 --- a/src/lib/libssl/src/crypto/rand/randfile.c +++ b/src/lib/libssl/src/crypto/rand/randfile.c @@ -221,7 +221,7 @@ const char *RAND_file_name(char *buf, int size) if (issetugid() == 0) s = getenv("RANDFILE"); - if (s != NULL && *s && strlen(s) < size) + if (s != NULL && *s && strlen(s) + 1 < size) { strlcpy(buf,s,size); ret=buf; -- cgit v1.2.3-55-g6feb