[Bug 305901] Re: Intrepid gcc -O2 breaks string appending with sprintf(), due to fortify source patch

Anders Kaseorg anders at kaseorg.com
Sun Dec 7 20:59:10 GMT 2008


>> pcregrep -M 'sprintf\s*\(\s*([^,]*)\s*,\s*"%s[^"]*"\s*,\s*\1\s*,'
>
> the regexp doesn't search for snprintf, and doesn't look for functions spanning more than one line.

It does with pcregrep -M.  For example,

$ pcregrep -M 'sprintf\s*\(\s*([^,]*)\s*,\s*"%s[^"]*"\s*,\s*\1\s*,' \
  linux-2.6/arch/x86/kernel/cpu/intel_cacheinfo.c
		ret += sprintf(buf, "%sEntry: %d\n", buf, i);
		ret += sprintf(buf, "%sReads:  %s\tNew Entries: %s\n",  
			buf,
		ret += sprintf(buf, "%sSubCache: %x\tIndex: %x\n",
			buf, (reg & 0x30000) >> 16, reg & 0xfff);

However, it appears that the multiline results did not show up in Kees’
reports, so the reports should be rerun with pcregrep -M if that is
possible.

-- 
Intrepid gcc -O2 breaks string appending with sprintf(), due to fortify source patch
https://bugs.launchpad.net/bugs/305901
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to nagios-plugins in ubuntu.



More information about the Ubuntu-server-bugs mailing list