OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: strlen(NULL) segfault

From: Gordon Stratton (tsr2600gmail.com)
Date: Sat Dec 01 2007 - 17:02:43 CST


On Dec 1, 2007 2:23 PM, Miod Vallat <miodonline.fr> wrote:
> Having strlen return zero for an argument of NULL, instead of causing a
> segmentation fault, is one of them.

I just tested this on a couple Linux systems, and strlen segfaults when
handed a NULL (glibc 2.7). Maybe glibc used to return 0 in this case,
but I can't find any references to it having this behavior (plenty of
threads where people suggested it return 0, though!)

Gordon