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 | |
parent | 37d60d970c342b7f21a173a363c8be6558ad6e6e (diff) | |
download | glibc-9781a370023952383028e07399fd196a889bb2be.tar.gz |
Handle mblen return code when n is zero.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | wcsmbs/mbrtoc16.c | 3 | ||||
-rw-r--r-- | wcsmbs/mbrtowc.c | 3 |
4 files changed, 17 insertions, 5 deletions
@@ -1,3 +1,9 @@ +2015-04-03 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> + + [BZ #17596] + * wcsmbs/mbrtowc.c (__mbrtowc): Add check for n=0. + * wcsmbs/mbrtoc16.c (mbrtoc16): Likewise. + 2015-04-02 Florian Weimer <fweimer@redhat.com> * include/libc-internal.h (libc_max_align_t): Define. @@ -11,11 +11,11 @@ Version 2.22 4719, 13064, 14094, 14841, 14906, 15319, 15467, 15790, 15969, 16351, 16512, 16560, 16783, 16850, 17090, 17195, 17269, 17523, 17542, 17569, - 17588, 17620, 17621, 17628, 17631, 17711, 17776, 17779, 17792, 17836, - 17912, 17916, 17932, 17944, 17949, 17964, 17965, 17967, 17969, 17978, - 17987, 17991, 17996, 17998, 17999, 18019, 18020, 18029, 18030, 18032, - 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18068, 18080, 18093, - 18100, 18104, 18110, 18111, 18128, 18138, 18185. + 17588, 17596, 17620, 17621, 17628, 17631, 17711, 17776, 17779, 17792, + 17836, 17912, 17916, 17932, 17944, 17949, 17964, 17965, 17967, 17969, + 17978, 17987, 17991, 17996, 17998, 17999, 18019, 18020, 18029, 18030, + 18032, 18036, 18038, 18039, 18042, 18043, 18046, 18047, 18068, 18080, + 18093, 18100, 18104, 18110, 18111, 18128, 18138, 18185. * A powerpc and powerpc64 optimization for TLS, similar to TLS descriptors for LD and GD on x86 and x86-64, has been implemented. You will need 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); diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index 49ca9c27f9..dbfe9403a6 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); |