mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-25 16:30:05 +01:00
snprintf doesn't terminate the string if it truncates, so things like
this are lurking crashers:
../hw/dmx/dmxprop.c: In function ‘dmxPropertyIdentifier.part.0’:
../hw/dmx/dmxprop.c:94:36: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 123 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
^~ ~~~~~~~~
../hw/dmx/dmxprop.c:94:5: note: ‘snprintf’ output 7 or more bytes (assuming 262) into a destination of size 128
snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../hw/dmx/dmxprop.c: In function ‘dmxPropertyWindow’:
../hw/dmx/dmxprop.c:372:36: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 127 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
^~
../hw/dmx/dmxprop.c:372:5: note: ‘snprintf’ output between 3 and 140 bytes into a destination of size 128
snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We could be more precise about termination, but meh.
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Keith Packard <keithp@keithp.com>
|
||
|---|---|---|
| .. | ||
| config | ||
| doc | ||
| doxygen | ||
| examples | ||
| glxProxy | ||
| input | ||
| man | ||
| .gitignore | ||
| dmx-config.h | ||
| dmx.c | ||
| dmx.h | ||
| dmx_glxvisuals.c | ||
| dmx_glxvisuals.h | ||
| dmxcb.c | ||
| dmxcb.h | ||
| dmxclient.h | ||
| dmxcmap.c | ||
| dmxcmap.h | ||
| dmxcursor.c | ||
| dmxcursor.h | ||
| dmxdpms.c | ||
| dmxdpms.h | ||
| dmxextension.c | ||
| dmxextension.h | ||
| dmxfont.c | ||
| dmxfont.h | ||
| dmxgc.c | ||
| dmxgc.h | ||
| dmxgcops.c | ||
| dmxgcops.h | ||
| dmxinit.c | ||
| dmxinit.h | ||
| dmxinput.c | ||
| dmxinput.h | ||
| dmxlog.c | ||
| dmxlog.h | ||
| dmxpict.c | ||
| dmxpict.h | ||
| dmxpixmap.c | ||
| dmxpixmap.h | ||
| dmxprop.c | ||
| dmxprop.h | ||
| dmxscrinit.c | ||
| dmxscrinit.h | ||
| dmxstat.c | ||
| dmxstat.h | ||
| dmxsync.c | ||
| dmxsync.h | ||
| dmxvisual.c | ||
| dmxvisual.h | ||
| dmxwindow.c | ||
| dmxwindow.h | ||
| Makefile.am | ||
| meson.build | ||