about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOndřej Bílka <neleai@seznam.cz>2015-04-03 15:46:29 +0200
committerOndřej Bílka <neleai@seznam.cz>2015-04-03 15:47:12 +0200
commit9781a370023952383028e07399fd196a889bb2be (patch)
treed2bdc44694972edf0396a73342f5738898d4c066
parent37d60d970c342b7f21a173a363c8be6558ad6e6e (diff)
downloadglibc-9781a370023952383028e07399fd196a889bb2be.tar.gz
glibc-9781a370023952383028e07399fd196a889bb2be.tar.xz
glibc-9781a370023952383028e07399fd196a889bb2be.zip
Handle mblen return code when n is zero.
-rw-r--r--ChangeLog6
-rw-r--r--NEWS10
-rw-r--r--wcsmbs/mbrtoc16.c3
-rw-r--r--wcsmbs/mbrtowc.c3
4 files changed, 17 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 9bac2983e4..54831a7c7f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/NEWS b/NEWS
index 14d54d6217..deadf2e815 100644
--- a/NEWS
+++ b/NEWS
@@ -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);