From: Bartosz Brachaczek <b.brachaczek@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] [PATCH] getentropy: fix UB if len==0
Date: Fri, 17 Jul 2020 01:27:21 +0200 [thread overview]
Message-ID: <CAGxPR-_0i0L+48p8cTCLDATyyFdCGjTko6KnovV2Aq=94-9QjQ@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 27 bytes --]
Patch attached.
--Bartosz
[-- Attachment #1.2: Type: text/html, Size: 72 bytes --]
[-- Attachment #2: 0001-getentropy-fix-UB-if-len-0.patch --]
[-- Type: application/octet-stream, Size: 641 bytes --]
From a386bcdd2ba75356eb2123f9281ed7d4932951ec Mon Sep 17 00:00:00 2001
From: Bartosz Brachaczek <b.brachaczek@gmail.com>
Date: Fri, 17 Jul 2020 01:16:28 +0200
Subject: [PATCH] getentropy: fix UB if len==0
if len==0, an uninitalized variable would be returned
---
src/misc/getentropy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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) {
--
2.25.1
next reply other threads:[~2020-07-16 23:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 23:27 Bartosz Brachaczek [this message]
2020-07-24 18:55 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGxPR-_0i0L+48p8cTCLDATyyFdCGjTko6KnovV2Aq=94-9QjQ@mail.gmail.com' \
--to=b.brachaczek@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).