From a2cdaa4cb68990ee8301f5b605ec2ab2a14c5716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 16 Feb 2006 10:08:34 +0000 Subject: [PATCH] (BN_rand): check return value from RAND_bytes git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16747 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/des/bn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/des/bn.c b/lib/des/bn.c index d8ded6e7e..859182f9f 100644 --- a/lib/des/bn.c +++ b/lib/des/bn.c @@ -337,7 +337,11 @@ BN_rand(BIGNUM *bn, int bits, int top, int bottom) return 0; i->length = len; - RAND_bytes(i->data, i->length); + if (RAND_bytes(i->data, i->length) != 1) { + free(i->data); + i->data = NULL; + return 0; + } { size_t i = len * 8;