This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Set behavior of sprintf-like functions with overlapping source and destination


Dumb question: if fortification is enabled, why can't sprintf-like functions report an error when the source and destination overlap? The point of fortification is to catch and report undefined behavior when it's easy, as is the case here.

/* Test the sprintf (buf, "%s", buf) does not override buf.

I'm leery of adding this test case, as it tests undefined behavior that the glibc manual does not document as an extension (and it shouldn't be documented either).

Traditionally we didn't worry about breaking code like PughUtils.c's 'sprintf(mess,"%s %d",mess,...)' under the principle that such code was already broken. Why depart from that tradition here?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]