diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c index 513e3389859e9f4a504cbd0796d1df3b88315cd7..adfec83b7bd88ff3ebe4f62edc18b9ff3076862a 100644 --- a/crypto/rand/rand_lib.c +++ b/crypto/rand/rand_lib.c @@ -154,6 +154,7 @@ void RAND_add(const void *buf, int num, double entropy) int RAND_bytes(unsigned char *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); + memset(buf, 0, num); if (meth && meth->bytes) return meth->bytes(buf,num); return(-1); @@ -162,6 +163,7 @@ int RAND_bytes(unsigned char *buf, int num) int RAND_pseudo_bytes(unsigned char *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); + memset(buf, 0, num); if (meth && meth->pseudorand) return meth->pseudorand(buf,num); return(-1);