about summary refs log tree commit diff
path: root/iconvdata/tcvn5712-1.c
diff options
context:
space:
mode:
authorTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2012-03-30 10:43:43 +0200
committerAndreas Jaeger <aj@suse.de>2012-03-30 10:43:43 +0200
commite64d2de526d8cfa2908e08892a534316a0bddf5f (patch)
treee962afa939a9c6adaf5a543b5c88215e7b27d093 /iconvdata/tcvn5712-1.c
parent20fde227388fb0c2857ff1793754056b833697fe (diff)
downloadglibc-e64d2de526d8cfa2908e08892a534316a0bddf5f.tar.gz
glibc-e64d2de526d8cfa2908e08892a534316a0bddf5f.tar.xz
glibc-e64d2de526d8cfa2908e08892a534316a0bddf5f.zip
Fix a bug when converting strings with 1 character using TCVN5712-1
It isn't necessary to buffer the last character of strings. This can cause a
bug with strings that have 1 character between 0x0041 and 0x01b0.

	[BZ #13691]
	* iconvdata/tcvn5712-1.c (FROM_LOOP): Fix a bug when converting strings
	with only 1 character between 0x0041 and 0x01b0.
	* wcsmbs/Makefile (tests): Add tst-mbsnrtowcs.
	* wcsmbs/tst-mbsnrtowcs.c: New file.
Diffstat (limited to 'iconvdata/tcvn5712-1.c')
-rw-r--r--iconvdata/tcvn5712-1.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/iconvdata/tcvn5712-1.c b/iconvdata/tcvn5712-1.c
index 49d5430f27..09dcbbfac9 100644
--- a/iconvdata/tcvn5712-1.c
+++ b/iconvdata/tcvn5712-1.c
@@ -1,5 +1,5 @@
 /* Conversion to and from TCVN5712-1.
-   Copyright (C) 2001, 2002, 2004, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2001-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -379,7 +379,7 @@ static const struct
     last_ch = *statep >> 3;						      \
 									      \
     /* We have to buffer ch if it is a possible match in comp_table_data.  */ \
-    must_buffer_ch = (ch >= 0x0041 && ch <= 0x01b0);			      \
+    must_buffer_ch = last_ch && (ch >= 0x0041 && ch <= 0x01b0);		      \
 									      \
     if (last_ch)							      \
       {									      \