public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kees at outflux dot net" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/7075] sprintf(buf, "%sfoo", buf) has different results with -O2 -D_FORTIFY_SOURCE=2 (__sprintf_chk bug?) Date: Fri, 13 Jun 2014 20:36:00 -0000 [thread overview] Message-ID: <bug-7075-131-8bQlnlly6y@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-7075-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=7075 --- Comment #12 from Kees Cook <kees at outflux dot net> --- It's not defined in POSIX, but it has worked a certain way in glibc for decades. There's no _reason_ to break it for _FORTIFY_SOURCE. Pre-truncating just silently breaks programs and does weird stuff. If you want to expose it with _FORITFY_SOURCE then have vsprintf notice that the target and first format argument are the same variable, and refuse to build. Either pretruncation should be eliminated, or the undefined behavior should be explicitly detected and dealt with. Just having programs lose data while running with no indication of the cause seems like a terrible user experience. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2014-06-13 20:36 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-7075-131@http.sourceware.org/bugzilla/> 2014-02-16 17:44 ` jackie.rosen at hushmail dot com 2014-05-28 19:42 ` schwab at sourceware dot org 2014-06-13 19:49 ` kees at outflux dot net 2014-06-13 20:25 ` schwab@linux-m68k.org 2014-06-13 20:36 ` kees at outflux dot net [this message] 2014-06-13 20:48 ` siddhesh at redhat dot com 2014-06-16 10:57 ` fweimer at redhat dot com 2008-12-07 17:43 [Bug libc/7075] New: " kees at outflux dot net 2008-12-07 17:44 ` [Bug libc/7075] " kees at outflux dot net 2008-12-07 17:52 ` schwab at suse dot de 2008-12-07 18:36 ` kees at outflux dot net 2008-12-07 19:08 ` schwab at suse dot de 2008-12-07 22:57 ` jakub at redhat dot com 2008-12-07 23:39 ` pasky at suse dot cz 2008-12-19 16:58 ` mtk dot manpages at gmail dot com 2008-12-24 17:41 ` kees at outflux dot net 2009-02-05 8:55 ` lidaobing at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-7075-131-8bQlnlly6y@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).