This is the mail archive of the libc-alpha@sources.redhat.com 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: Calling strcmp/strncmp/strcasecmp/strncasecmp with NULL parameter


> in the not so unlikely event, that one of the string compare functions is
> called with NULL as one parameter the process will get a SIGSEGV, because
> the functions are dereferencing NULL pointers (i'm referring to the funcs
> found in sysdeps/generic). I doubt this is intended behaviour, IMHO these
> function should not fail, no matter what the input is.

You are mistaken.  Most functions that take pointers have undefined
behavior when given a null pointer or any other inappropriate pointer value.
They behave just like the * operator in this regard.  Getting a SIGSEGV is
in fact the single most useful thing that could happen here.


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