Bug 14898

Summary: Shouldn't use the buffer as parameter
Product: xorg Reporter: Samuel Thibault <samuel.thibault>
Component: Lib/XlibAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: ettl.martin
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

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.