From e4f922b833025d8f7c7c4557ccb66461de8f4cdd Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Fri, 9 Aug 2013 14:58:18 +0200 Subject: [PATCH] bugfix: set new random value when more than sizeof(v) bytes are requested The function contiki_prng_impl() used to fill the entire buffer with the same two bytes of random data. (Thanks to Andreas Bender for pointing out.) --- prng.h | 1 + 1 file changed, 1 insertion(+) diff --git a/prng.h b/prng.h index e86cdc59..ce4cb128 100644 --- a/prng.h +++ b/prng.h @@ -50,6 +50,7 @@ contiki_prng_impl(unsigned char *buf, size_t len) { memcpy(buf, &v, sizeof(v)); len -= sizeof(v); buf += sizeof(v); + v = random_rand(); } memcpy(buf, &v, len);