[systemd-devel] [bug] (char*)NULL should be used in variadic functions

Vasily Kulikov segoon at openwall.com
Tue Jan 29 23:07:50 PST 2013


Hi,

systemd uses plain NULL as an argument of variadic functions, which is a
UB in C.  (char*)NULL should be used instead.  Plain NULL may be defined
as "0" or smth.

>From C99:

"6.3.2.3 Pointers

...

3
An integer constant expression with the value 0, or such an expression
cast to type void *, is called a null pointer constant.

...

7.17 Common definitions <stddef.h>

...

3
The macros are NULL which expands to an implementation-defined null
pointer constant;"

NULL is wrongly used e.g. in sd_journal_send() in
src/journal/test-journal-send.c.


Thanks,

-- 
Vasily Kulikov
http://www.openwall.com - bringing security into open computing environments


More information about the systemd-devel mailing list