From ec263fc5a48e425530490b29baf2c512b1ce907f Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Fri, 25 Sep 2009 14:53:31 -0700 Subject: [PATCH] reading negative size is wrong, zero is ok --- lib/hcrypto/rand-unix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/hcrypto/rand-unix.c b/lib/hcrypto/rand-unix.c index 2bfa265fa..fcad39f1d 100644 --- a/lib/hcrypto/rand-unix.c +++ b/lib/hcrypto/rand-unix.c @@ -95,8 +95,10 @@ unix_bytes(unsigned char *outdata, int size) ssize_t count; int once = 0; - if (size <= 0) + if (size < 0) return 0; + else if (size == 0) + return 1; HEIMDAL_MUTEX_lock(&random_mutex); if (random_fd == -1) {