Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 12 Sep 2018 15:46:35 -0400
From: Rich Felker <>
Subject: Re: string-backed FILEs mess

On Wed, Sep 12, 2018 at 09:30:22PM +0200, Markus Wichmann wrote:
> On Wed, Sep 12, 2018 at 01:48:37PM -0500, A. Wilcox wrote:
> > Happy early Hallowe'en:
> > 
> >
> > 
> You know, if I were programming on Linux professionally rather than as a
> hobby, stuff like this would drive me to drink. I mean, in this case it
> is a return value on a pathological case, but actually, it's sort of my
> point: C says, snprintf() is undefined with a buffer size of more than
> INT_MAX, POSIX defines it, and GCC just goes with the ISO-C version --
> because they can? Great!

In this case, it's not undefined. ISO C defines it as success (there's
nothing erroneous about the buffer being large; it's only an error if
the output would exceed INT_MAX in length). POSIX then erroneously
(because it nominally extends C and defers to it in case of accidental
conflict) redefines it as an error.


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.