• R/O
  • HTTP
  • SSH
  • HTTPS

chasen: Commit

The ChaSen legacy source.


Commit MetaInfo

Revision05f4be730e9e672bfeae867d9f23055aa3e72ee1 (tree)
Time2011-11-24 10:36:29
AuthorNOKUBI Takatsugu <knok@daio...>
CommiterNOKUBI Takatsugu

Log Message

Added length check in chasen_sparse_main.

Change Summary

Incremental Difference

--- a/lib/chalib.c
+++ b/lib/chalib.c
@@ -306,9 +306,14 @@ chasen_sparse_main(char *input, FILE *output)
306306 */
307307 while (*input) {
308308 int c = 0, len, cursor;
309- if ((crlf = strpbrk(input, "\r\n")) == NULL)
309+ if ((crlf = strpbrk(input, "\r\n")) == NULL) {
310310 len = strlen(input);
311- else {
311+ if (len >= CHA_INPUT_SIZE) {
312+ len = CHA_INPUT_SIZE - 1;
313+ crlf = input + CHA_INPUT_SIZE - 2;
314+ c = 0;
315+ }
316+ } else {
312317 len = crlf - input;
313318 c = *crlf;
314319 *crlf = '\0';
Show on old repository browser