From 7debff3867c0c087ccae465517aa26e475266427 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 20 Jan 1999 18:10:35 +0000 Subject: See ChangeLog: Wed Jan 20 18:59:49 CET 1999 Werner Koch --- cipher/rndunix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cipher/rndunix.c') diff --git a/cipher/rndunix.c b/cipher/rndunix.c index f0b631975..716b02672 100644 --- a/cipher/rndunix.c +++ b/cipher/rndunix.c @@ -709,6 +709,7 @@ gather_random( void (*add)(const void*, size_t, int), int requester, /* now read from the gatherer */ while( length ) { int goodness; + ulong subtract; if( read_a_msg( pipedes[0], &msg ) ) { g10_log_error("reading from gatherer pipe failed: %s\n", @@ -742,7 +743,9 @@ gather_random( void (*add)(const void*, size_t, int), int requester, (*add)( msg.data, n, requester ); /* this is the trick how e cope with the goodness */ - length -= (ulong)n * goodness / 100; + subtract = (ulong)n * goodness / 100; + /* subtract at least 1 byte to avoid infinite loops */ + length -= subtract ? subtract : 1; } return 0; -- cgit v1.2.3