Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50F10D89.4050909@gentoo.org>
Date: Sat, 12 Jan 2013 08:15:21 +0100
From: Luca Barbato <lu_zero@...too.org>
To: musl@...ts.openwall.com
Subject: Re: NULL

On 12/01/13 07:46, Rich Felker wrote:
> On Sat, Jan 12, 2013 at 12:32:44AM -0600, Rob Landley wrote:
>> On 01/09/2013 07:36:43 AM, John Spencer wrote:
>>>> using NULL in the argument of variadic functions is ub both
>>>> in c and c++
>>>
>>> many developers don't care about the standard. they take the stance:
>>> "works for me, if you want it patched then do it yourself and
>>> we'll eventually merge"
>>
>> Why is it UB? The standard says it's a pointer. If you pull %p off
>> in printf, feeding NULL in that slot should work fine.
> 
> See my other message. NULL is not required to have pointer type. It
> can be any null pointer constant, which includes things like 0, 0L,
> 0ULL, (sizeof 1 - sizeof 2), (void *)(1ULL/2ULL), etc.
> 
> The %p specifier, on the other hand, requires an argument of type void
> *; passing any other type yields UB.

so printf("%s", NULL) would lead to UB if NULL is 0L ?

lu

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.