]> git.eshelyaron.com Git - emacs.git/commitdiff
(CCL_WRITE_CHAR): If CH is eight-bit-control char, decrement dst_end
authorKenichi Handa <handa@m17n.org>
Wed, 16 Aug 2000 01:36:35 +0000 (01:36 +0000)
committerKenichi Handa <handa@m17n.org>
Wed, 16 Aug 2000 01:36:35 +0000 (01:36 +0000)
to avoid buffer overflow in the later call of string_as_multibyte

src/ccl.c

index c99c0a5414c2111b85f25afe0a86d1e234fb1b8e..c56798f1a5fe5a721c838674e6a2014c8d79e7fc 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -685,7 +685,13 @@ static tr_stack *mapping_stack_pointer;
              *dst++ = '\n';                                    \
          }                                                     \
        else if (bytes == 1)                                    \
-         *dst++ = (ch);                                        \
+         {                                                     \
+           *dst++ = (ch);                                      \
+           if ((ch) >= 0x80 && (ch) < 0xA0)                    \
+             /* We may have to convert this eight-bit char to  \
+                multibyte form later.  */                      \
+             dst_end--;                                        \
+         }                                                     \
        else                                                    \
          dst += CHAR_STRING (ch, dst);                         \
       }                                                                \