|
Message-ID: <20150425181924.GA1927@newbook> Date: Sat, 25 Apr 2015 11:19:25 -0700 From: Isaac Dunham <ibid.ag@...il.com> To: musl@...ts.openwall.com Subject: Re: [PATCH] fmtmsg: verify that label is in the correct format On Sat, Apr 25, 2015 at 01:14:17PM -0400, Rich Felker wrote: > On Sat, Apr 25, 2015 at 09:15:35AM -0700, Isaac Dunham wrote: > > According to POSIX, "the format is two fields separated by a colon. > > The first field is up to 10 bytes, the second is up to 14 bytes." > > The original implementation assumed that the application provided > > a valid label. > > Is there a particular problem you're trying to solve? It's not clear > to me from the text (which seems under-specified) whether there's an > obligation to diagnose errors here, or whether failure to meet the > contract for the format of the inputs yields unspecified or undefined > behavior. I'm not necessarily opposed to the change but I'd like to > understand this better so that it would be well-motivated. It's not clear to me whether there's an obligation according to POSIX, and I haven't seen any issues. The discussion of how to handle setenv(..., NULL, ...) reminded me that glibc fmtmsg *does* fail on incorrectly-formatted labels, and I thought it was worthwile to be consistent about rejecting invalid inputs, so as to discourage the spread of wrong code (ie, if people use invalid labels while testing with musl and then learn about the issue when someone uses it on a non-musl platform). But that's the only reason. I will acknowledge that the meaning of fmtmsg(MM_CONSOLE|MM_SOFT|MM_APPL|MM_RECOV, "a bad label", MM_INFO, "the label here is wrong", "change the label in the source", MM_NULLTAG); is clear, unlike whether setenv("VAR", NULL, 1) should set VAR to "" or unset VAR. Thanks, Isaac Dunham
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.