summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Brachaczek <b.brachaczek@gmail.com>2020-07-17 01:16:28 +0200
committerRich Felker <dalias@aerifal.cx>2020-07-24 14:54:40 -0400
commitddf1750e42e17f75e765d494874308c6393118bb (patch)
tree34f7e1e564761e770c85721a2900fbbc2780b511
parent52ee0dd6d5ccefcbf9b55748896c85801bfafd17 (diff)
downloadmusl-ddf1750e42e17f75e765d494874308c6393118bb.tar.gz
musl-ddf1750e42e17f75e765d494874308c6393118bb.tar.bz2
musl-ddf1750e42e17f75e765d494874308c6393118bb.tar.xz
musl-ddf1750e42e17f75e765d494874308c6393118bb.zip
getentropy: fix UB if len==0
if len==0, an uninitalized variable would be returned
-rw-r--r--src/misc/getentropy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/misc/getentropy.c b/src/misc/getentropy.c
index d2f282ce..651ea95f 100644
--- a/src/misc/getentropy.c
+++ b/src/misc/getentropy.c
@@ -6,7 +6,7 @@
int getentropy(void *buffer, size_t len)
{
- int cs, ret;
+ int cs, ret = 0;
char *pos = buffer;
if (len > 256) {