fix failure of mbsinit(0) (not UB; required to return nonzero)
[musl] / src / multibyte / mbsinit.c
index d307e5a..c0e7e49 100644 (file)
@@ -13,5 +13,5 @@
 
 int mbsinit(const mbstate_t *st)
 {
-       return !*(unsigned *)st;
+       return !st || !*(unsigned *)st;
 }