[Bug libc/24826] New: Test for getentropy() accidentally succeeding

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug libc/24826] New: Test for getentropy() accidentally succeeding

giuliomoro at yahoo dot it
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 <[hidden email]>
    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.
Reply | Threaded
Open this post in threaded view
|

[Bug libc/24826] Test for getentropy() accidentally succeeding

giuliomoro at yahoo dot it
https://sourceware.org/bugzilla/show_bug.cgi?id=24826

Olivier Gayot <olivier.gayot at sigexec dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com,
                   |                            |olivier.gayot at sigexec dot com

--
You are receiving this mail because:
You are on the CC list for the bug.