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.)
This commit is contained in:
Olaf Bergmann committed 2013-08-09 15:00:35 +02:00
1 parent accc094785
commit e4f922b833
1 file changed
+1
+1
View File
@@ -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);