From 87f6057a312d53deac1293201fe7e2e6f9a433c0 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 23 Aug 2000 06:59:33 +0000 Subject: In conversion to ISO-2022-JP, add two missing buffer size checks. --- iconvdata/iso-2022-jp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; \ -- cgit 1.4.1