diff options
author | beck <> | 2001-01-12 18:15:59 +0000 |
---|---|---|
committer | beck <> | 2001-01-12 18:15:59 +0000 |
commit | ff8efdd42a4336723282416a5045bae7c8b32c8a (patch) | |
tree | db7a7e71c72bc168b60b9c731c03298c496f5095 | |
parent | 15bbf14b6dec9d110311f371debc4d77939bbd83 (diff) | |
download | openbsd-ff8efdd42a4336723282416a5045bae7c8b32c8a.tar.gz openbsd-ff8efdd42a4336723282416a5045bae7c8b32c8a.tar.bz2 openbsd-ff8efdd42a4336723282416a5045bae7c8b32c8a.zip |
make sure s always has enough from for trailing \0. even though strlcpy will
truncate, thanks to itojun@
-rw-r--r-- | src/lib/libcrypto/rand/randfile.c | 2 | ||||
-rw-r--r-- | 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) | |||
221 | 221 | ||
222 | if (issetugid() == 0) | 222 | if (issetugid() == 0) |
223 | s = getenv("RANDFILE"); | 223 | s = getenv("RANDFILE"); |
224 | if (s != NULL && *s && strlen(s) < size) | 224 | if (s != NULL && *s && strlen(s) + 1 < size) |
225 | { | 225 | { |
226 | strlcpy(buf,s,size); | 226 | strlcpy(buf,s,size); |
227 | ret=buf; | 227 | 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) | |||
221 | 221 | ||
222 | if (issetugid() == 0) | 222 | if (issetugid() == 0) |
223 | s = getenv("RANDFILE"); | 223 | s = getenv("RANDFILE"); |
224 | if (s != NULL && *s && strlen(s) < size) | 224 | if (s != NULL && *s && strlen(s) + 1 < size) |
225 | { | 225 | { |
226 | strlcpy(buf,s,size); | 226 | strlcpy(buf,s,size); |
227 | ret=buf; | 227 | ret=buf; |