Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 320785 - net-mail/altermime: fails with _FORTIFY_SOURCE=2
Summary: net-mail/altermime: fails with _FORTIFY_SOURCE=2
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Net-Mail Packages
: 323071 (view as bug list)
Depends on:
Blocks: werror fortify-source
  Show dependency tree
Reported: 2010-05-20 20:43 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2010-06-07 13:17 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---

Build log (altermime-0.3.10:20100519-201721.log,2.28 KB, text/plain)
2010-05-20 20:43 UTC, Diego Elio Pettenò (RETIRED)
Patch to fix length parameter passed to snprintf (altermime-MIME_headers-overflow.patch,605 bytes, patch)
2010-05-22 19:52 UTC, Kevin Pyle
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.

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 <>
+  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. ***