Skip to contentSkip to conversation

The string passed to sscanf() contains an uninitialized value.

Bug 99045 [email protected] 1 participant 4 messages Dec 10, 2016 – Jan 16, 2017

lore
Share & tools
lore
#0 lore raw

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: [email protected]
Reporter: [email protected]

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"

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw

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

--- Comment #1 from Emil Velikov <[email protected]> --- Hi Taro Yamada, please git send-email patches to [email protected]. If you can set the prefix that'll be even better ;-)

$ git config --local format.subjectPrefix "PATCH libdrm"
Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
In reply to [email protected]

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

Emil Velikov <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Emil Velikov <[email protected]> --- Just pushed the patch to master. Thanks !

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel