]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - wcsmbs/mbrtowc.c
Handle mblen return code when n is zero.
[thirdparty/glibc.git] / wcsmbs / mbrtowc.c
index 49ca9c27f949f3999cd1c7eb617b1ea650e5492c..dbfe9403a64a544a233a7b9d8f6bcab92d9edb28 100644 (file)
@@ -59,6 +59,9 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
       n = 1;
     }
 
+  if (n == 0)
+    return (size_t) -2;
+
   /* Tell where we want the result.  */
   data.__outbuf = outbuf;
   data.__outbufend = outbuf + sizeof (wchar_t);