Mercurial > emacs
comparison src/coding.c @ 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 | a5023e8bbb1e |
| children | a12d39ca6870 |
comparison
equal
deleted
inserted
replaced
| 102114:ee027af2a372 | 102115:db1f94e25359 |
|---|---|
| 6803 /* Record unprocessed bytes in coding->carryover. We are | 6803 /* Record unprocessed bytes in coding->carryover. We are |
| 6804 sure that the number of data is less than the size of | 6804 sure that the number of data is less than the size of |
| 6805 coding->carryover. */ | 6805 coding->carryover. */ |
| 6806 unsigned char *p = coding->carryover; | 6806 unsigned char *p = coding->carryover; |
| 6807 | 6807 |
| 6808 if (nbytes > sizeof coding->carryover) | |
| 6809 nbytes = sizeof coding->carryover; | |
| 6808 coding->carryover_bytes = nbytes; | 6810 coding->carryover_bytes = nbytes; |
| 6809 while (nbytes-- > 0) | 6811 while (nbytes-- > 0) |
| 6810 *p++ = *src++; | 6812 *p++ = *src++; |
| 6811 } | 6813 } |
| 6812 coding->consumed = coding->src_bytes; | 6814 coding->consumed = coding->src_bytes; |
