summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog1
-rw-r--r--src/coding.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ffe4722902d..097cd2812d1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -5,6 +5,7 @@
2009-02-19 Kenichi Handa <handa@m17n.org>
* coding.c (detect_coding): Preserve coding->mode.
+ Don't overflow coding->carryover.
2009-02-18 Dan Nicolaescu <dann@ics.uci.edu>
diff --git a/src/coding.c b/src/coding.c
index ec57467f023..313e4021486 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6805,6 +6805,8 @@ decode_coding (coding)
coding->carryover. */
unsigned char *p = coding->carryover;
+ if (nbytes > sizeof coding->carryover)
+ nbytes = sizeof coding->carryover;
coding->carryover_bytes = nbytes;
while (nbytes-- > 0)
*p++ = *src++;