about summary refs log tree commit diff
path: root/iconvdata/sjis.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-23 05:52:43 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-23 05:52:43 +0000
commitcf970a32156e60e8842c5e9e82a3cb147dacaf64 (patch)
tree7c8300ee994a7c0cf9d4c67b41d464f29972d4c3 /iconvdata/sjis.c
parentdc63ee35750ed8db3e0d7938e74bbadb8cff8446 (diff)
downloadglibc-cf970a32156e60e8842c5e9e82a3cb147dacaf64.tar.gz
glibc-cf970a32156e60e8842c5e9e82a3cb147dacaf64.tar.xz
glibc-cf970a32156e60e8842c5e9e82a3cb147dacaf64.zip
Update.
	* iconvdata/sjis.c: In conversion from UCS4, correct test for
	enough room in target buffer.
	Patch by KUSANO Takayuki <AE5T-KSN@asahi-net.or.jp> [PR libc/1865].
	* iconvdata/bug-iconv1.c: New file.
	* iconvdata/Makefile (tests): Add bug-iconv1.
Diffstat (limited to 'iconvdata/sjis.c')
-rw-r--r--iconvdata/sjis.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c
index 8d907b863c..244cec6db4 100644
--- a/iconvdata/sjis.c
+++ b/iconvdata/sjis.c
@@ -4484,18 +4484,19 @@ static const char from_ucs4_extra[0x100][2] =
       }									      \
     else								      \
       {									      \
-	*outptr++ = cp[0];						      \
+	*outptr = cp[0];						      \
 	/* Now test for a possible second byte and write this if possible.  */\
 	if (cp[1] != '\0')						      \
 	  {								      \
-	    if (__builtin_expect (outptr >= outend, 0))			      \
+	    if (__builtin_expect (outptr + 1 >= outend, 0))		      \
 	      {								      \
 		/* The result does not fit into the buffer.  */		      \
 		result = __GCONV_FULL_OUTPUT;				      \
 		break;							      \
 	      }								      \
-	    *outptr++ = cp[1];						      \
+	    *++outptr = cp[1];						      \
 	  }								      \
+	++outptr;							      \
       }									      \
 									      \
     inptr += 4;								      \