[Bug 99045] The string passed to sscanf() contains an uninitialized value.

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Dec 10 11:57:07 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=99045

            Bug ID: 99045
           Summary: The string passed to sscanf() contains an
                    uninitialized value.
           Product: DRI
           Version: unspecified
          Hardware: Other
                OS: Linux (All)
            Status: NEW
          Severity: normal
          Priority: medium
         Component: libdrm
          Assignee: dri-devel at lists.freedesktop.org
          Reporter: archer_ame at yahoo.co.jp

Created attachment 128403
  --> https://bugs.freedesktop.org/attachment.cgi?id=128403&action=edit
Patch to fix null termination.

The function drmParsePciBusInfo() in xf86drm.c reads the contents of the file
"/sys/dev/char/x:y/device/uevent" into the buffer.
The string written to the buffer by read() is not null-terminated, but this
function is writing null only at the end of the buffer.
As a result, the string passed to sscanf() contains an uninitialized value and
sscanf uses it.

For example,
The string that should be passed to sscanf().
"The contents of the file\0"

The string actually passed to sscanf().
"The contents of the file and uninitialized value until the end of the
buffer\0"

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20161210/4438e5fe/attachment.html>


More information about the dri-devel mailing list