Bug 162522
Summary: | _FORTIFY_SOURCE breaks sprintf(buffer, "%s%s", buffer, blah) | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Nicholas Miell <nmiell> | ||||
Component: | glibc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED NOTABUG | QA Contact: | Brian Brock <bbrock> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 4 | ||||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2005-07-05 20:05:59 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Nicholas Miell
2005-07-05 20:02:06 UTC
Created attachment 116381 [details]
Test program. Compile with and without -D_FORTIFY_SOURCE=1 to demonstrate the problem.
Using the same buffer as both a source and the destination triggers undefined behaviour in both ISO C and POSIX. Both outputs (as well as any other) are correct implementations. See e.g. http://www.opengroup.org/onlinepubs/009695399/functions/sprintf.html If copying takes place between objects that overlap as a result of a call to sprintf() or snprintf(), the results are undefined. |