changeset 102115:db1f94e25359

(detect_coding): Don't overflow coding->carryover.
author Kenichi Handa <handa@m17n.org>
date Thu, 19 Feb 2009 04:23:32 +0000
parents ee027af2a372
children 9ec9afbbb19d
files src/coding.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Thu Feb 19 03:33:09 2009 +0000
+++ b/src/coding.c	Thu Feb 19 04:23:32 2009 +0000
@@ -6805,6 +6805,8 @@
 	     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++;