diff options
author | Ondřej Bílka <neleai@seznam.cz> | 2015-04-03 15:46:29 +0200 |
---|---|---|
committer | Ondřej Bílka <neleai@seznam.cz> | 2015-04-03 15:47:12 +0200 |
commit | 9781a370023952383028e07399fd196a889bb2be (patch) | |
tree | d2bdc44694972edf0396a73342f5738898d4c066 /wcsmbs | |
parent | 37d60d970c342b7f21a173a363c8be6558ad6e6e (diff) | |
download | glibc-9781a370023952383028e07399fd196a889bb2be.zip glibc-9781a370023952383028e07399fd196a889bb2be.tar.gz glibc-9781a370023952383028e07399fd196a889bb2be.tar.bz2 |
Handle mblen return code when n is zero.
Diffstat (limited to 'wcsmbs')
-rw-r--r-- | wcsmbs/mbrtoc16.c | 3 | ||||
-rw-r--r-- | wcsmbs/mbrtowc.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/wcsmbs/mbrtoc16.c b/wcsmbs/mbrtoc16.c index 542e5cf..f23b242 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); diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index 49ca9c2..dbfe940 100644 --- a/wcsmbs/mbrtowc.c +++ b/wcsmbs/mbrtowc.c @@ -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); |