aboutsummaryrefslogtreecommitdiff
path: root/wcsmbs/mbrtoc16.c
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs/mbrtoc16.c')
-rw-r--r--wcsmbs/mbrtoc16.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/wcsmbs/mbrtoc16.c b/wcsmbs/mbrtoc16.c
index 542e5cf671..f23b24262b 100644
--- a/wcsmbs/mbrtoc16.c
+++ b/wcsmbs/mbrtoc16.c
@@ -77,6 +77,9 @@ mbrtoc16 (char16_t *pc16, 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);