about summary refs log tree commit diff
path: root/iconvdata/iso-2022-jp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-23 06:59:33 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-23 06:59:33 +0000
commit87f6057a312d53deac1293201fe7e2e6f9a433c0 (patch)
treedec5a0d0cd64900d4c2c8ac156a3c43b94c9017f /iconvdata/iso-2022-jp.c
parent7e7b6007f27b772ece49e185f250cb56307c6689 (diff)
downloadglibc-87f6057a312d53deac1293201fe7e2e6f9a433c0.tar.gz
glibc-87f6057a312d53deac1293201fe7e2e6f9a433c0.tar.xz
glibc-87f6057a312d53deac1293201fe7e2e6f9a433c0.zip
In conversion to ISO-2022-JP, add two missing buffer size checks.
Diffstat (limited to 'iconvdata/iso-2022-jp.c')
-rw-r--r--iconvdata/iso-2022-jp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c
index ecfdae4e47..fc34aaba96 100644
--- a/iconvdata/iso-2022-jp.c
+++ b/iconvdata/iso-2022-jp.c
@@ -577,6 +577,12 @@ gconv_end (struct __gconv_step *data)
       {									      \
 	if (set2 == ISO88591_set)					      \
 	  {								      \
+	    if (__builtin_expect (outptr + 3 > outend, 0))		      \
+	      {								      \
+		result = __GCONV_FULL_OUTPUT;				      \
+		break;							      \
+	      }								      \
+									      \
 	    if (ch >= 0x80 && ch <= 0xff) 				      \
 	      {								      \
 		*outptr++ = ESC;					      \
@@ -596,6 +602,12 @@ gconv_end (struct __gconv_step *data)
 		unsigned char res = iso88597_from_ucs4[ch - 0xa0 + rp->idx];  \
 		if (res != '\0')					      \
 		  {							      \
+		    if (__builtin_expect (outptr + 3 > outend, 0))	      \
+		      {							      \
+			result = __GCONV_FULL_OUTPUT;			      \
+			break;						      \
+		      }							      \
+									      \
 		    *outptr++ = ESC;					      \
 		    *outptr++ = 'N';					      \
 		    *outptr++ = res;					      \