Bug 14898 - Shouldn't use the buffer as parameter
Summary: Shouldn't use the buffer as parameter
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
: 22352 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-07 17:36 UTC by Samuel Thibault
Modified: 2009-06-18 13:56 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Samuel Thibault 2008-03-07 17:36:58 UTC
omGeneric.c, at line 618, performs

sprintf(rotate_font_ptr, "%s-%s", rotate_font_ptr, fields[field_num]);

This is not supposed to work: the standard prototype of sprintf is

int sprintf(char *restrict s, const char *restrict format, ...);

i.e. s is not supposed to appear in the arguments. It happens that I'm
getting a warning from valgrind:

==15975== Source and destination overlap in mempcpy(0x512D6D8, 0x512D6D8, 26)
==15975==    at 0x4026506: mempcpy (mc_replace_strmem.c:676)
==15975==    by 0x41E503D: _IO_default_xsputn (genops.c:469)
==15975==    by 0x41BE98A: vfprintf (vfprintf.c:1560)
==15975==    by 0x41D9FEB: vsprintf (iovsprintf.c:43)
==15975==    by 0x41C430D: sprintf (sprintf.c:34)
==15975==    by 0x55C02C8: get_rotate_fontname (omGeneric.c:618)

Can't we just call strcat?
Comment 1 Adam Jackson 2008-06-24 10:22:40 UTC
Fixed to use strcat in master.  Thanks!
Comment 2 Alan Coopersmith 2009-06-18 13:56:07 UTC
*** Bug 22352 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.