diff lib/mbsinit.c @ 14344:5cdebc45677d

mbsinit: Don't crash for a NULL argument. * lib/mbsinit.c (mbsinit): When the argument is NULL, return 1. * tests/test-mbsinit.c (mbsinit): Check this behaviour.
author Bruno Haible <bruno@clisp.org>
date Sun, 13 Feb 2011 18:04:55 +0100 (2011-02-13)
parents 97fc9a21a8fb
children 38e1a5ec714d
line wrap: on
line diff
--- a/lib/mbsinit.c
+++ b/lib/mbsinit.c
@@ -43,5 +43,5 @@
 {
   const char *pstate = (const char *)ps;
 
-  return pstate[0] == 0;
+  return pstate == NULL || pstate[0] == 0;
 }