Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 320785

Summary: net-mail/altermime: fails with _FORTIFY_SOURCE=2
Product: Gentoo Linux Reporter: Diego Elio Pettenò (RETIRED) <flameeyes>
Component: New packagesAssignee: Net-Mail Packages <net-mail+disabled>
Status: RESOLVED FIXED    
Severity: normal CC: esigra
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 260867, 259417    
Attachments: Build log
Patch to fix length parameter passed to snprintf

Description Diego Elio Pettenò (RETIRED) gentoo-dev 2010-05-20 20:43:33 UTC
The package in subject fails with gcc 4.3.3-r1 and modern glibc because of _FORTIFY_SOURCE=2 set by default.

Thanks,
Diego
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-05-20 20:43:57 UTC
Created attachment 232277 [details]
Build log
Comment 2 Kevin Pyle 2010-05-22 19:52:02 UTC
Created attachment 232511 [details, diff]
Patch to fix length parameter passed to snprintf

I cannot reproduce this problem with glibc-2.10 and gcc 4.3, but I see a problem which is likely the reason for the error message.  The call to snprintf passes buffer A, but the size of buffer B, where buffer B is much bigger than buffer A.  Thus, the code gives snprintf permission to overrun buffer A, up to the length of buffer B.  The fix is to change the argument to sizeof so that it computes the size of the buffer actually passed to snprintf.  The attached patch does that.
Comment 3 Samuli Suominen (RETIRED) gentoo-dev 2010-06-06 01:14:31 UTC
+  06 Jun 2010; Samuli Suominen <ssuominen@gentoo.org>
+  altermime-0.3.10.ebuild,
+  +files/altermime-0.3.10-MIME_headers-overflow.patch:
+  Fix building with _FORTIFY_SOURCE=2 wrt #320785 by Kevin Pyle.
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2010-06-07 13:17:36 UTC
*** Bug 323071 has been marked as a duplicate of this bug. ***