aboutsummaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-01-20 18:10:35 +0000
committerWerner Koch <[email protected]>1999-01-20 18:10:35 +0000
commit7debff3867c0c087ccae465517aa26e475266427 (patch)
treebcb1ccedb0ee7711cb28a6add0a16a56cf0d0c34 /cipher
parentSee ChangeLog: Tue Jan 19 19:34:58 CET 1999 Werner Koch (diff)
downloadgnupg-7debff3867c0c087ccae465517aa26e475266427.tar.gz
gnupg-7debff3867c0c087ccae465517aa26e475266427.zip
See ChangeLog: Wed Jan 20 18:59:49 CET 1999 Werner Koch
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog4
-rw-r--r--cipher/rndunix.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index c46ca5d86..273b6fdee 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jan 20 18:59:49 CET 1999 Werner Koch <[email protected]>
+
+ * rndunix.c (gather_random): Fix to avoid infinite loop.
+
Sun Jan 17 11:04:33 CET 1999 Werner Koch <[email protected]>
* des.c (is_weak_key): Replace system memcmp due to bugs
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;