This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/24826] New: Test for getentropy() accidentally succeeding
- From: "olivier.gayot at sigexec dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 18 Jul 2019 22:06:00 +0000
- Subject: [Bug libc/24826] New: Test for getentropy() accidentally succeeding
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=24826
Bug ID: 24826
Summary: Test for getentropy() accidentally succeeding
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: olivier.gayot at sigexec dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Created attachment 11913
--> https://sourceware.org/bugzilla/attachment.cgi?id=11913&action=edit
Patch for getentropy test
Good evening.
While reading the source code, I've realized that one test meant to detect a
defect in the getentropy() function always succeeds by accident.
This happens because of an incorrect use of parentheses at the following line
in the current master branch:
tst-getrandom.c:192: if (memcmp (buf, buf2, sizeof (buf) == 0))
This comparison always evaluates to true and the original intent was obviously
to compare the result of memcmp(...) to 0.
This test was added in 2016 in the following commit:
commit 92dcaa3e2f7bf0f7f1c04cd2fb6a317df1a4e225
Author: Florian Weimer <fweimer@redhat.com>
Date: Mon Dec 12 17:28:03 2016 +0100
Add getentropy, getrandom, <sys/random.h> [BZ #17252]
I'm attaching a patch fixing this test.
Kind regards,
Olivier
--
You are receiving this mail because:
You are on the CC list for the bug.