summaryrefslogtreecommitdiffstats
path: root/crypto/rand/randfile.c
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2002-11-13 15:43:43 +0000
committerBen Laurie <ben@openssl.org>2002-11-13 15:43:43 +0000
commit54a656ef081f72a740c550ebd8099b40b8b5cde0 (patch)
tree9b3638b56848c7f0648b84cfa7ad056116b37a1b /crypto/rand/randfile.c
parent8f797f14b8ff7d3d5cb04443284259a0c94860b3 (diff)
Security fixes brought forward from 0.9.7.
Diffstat (limited to 'crypto/rand/randfile.c')
-rw-r--r--crypto/rand/randfile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c
index 982074c465..7c2673a61f 100644
--- a/crypto/rand/randfile.c
+++ b/crypto/rand/randfile.c
@@ -203,8 +203,9 @@ const char *RAND_file_name(char *buf, size_t size)
s=getenv("RANDFILE");
if (s != NULL)
{
- strncpy(buf,s,size-1);
- buf[size-1]='\0';
+ if(strlen(s) >= size)
+ return NULL;
+ strcpy(buf,s);
ret=buf;
}
else