Skip to content

Commit

Permalink
Fix buffer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NOKUBI Takatsugu committed Jun 14, 2012
1 parent 1a441e4 commit a65e9d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2012-06-14 NOKUBI Takatsugu <[email protected]>

* lib/chalib.c (chasen_sparse_main):
fix buffer overflow
JVN#16901583 https://jvn.jp/jp/JVN16901583/index.html

2007-07-23 Asahara Masayuki <[email protected]>

* lib/tokenizer.c (cha_tok_parse):
Expand Down
9 changes: 7 additions & 2 deletions lib/chalib.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,14 @@ chasen_sparse_main(char *input, FILE *output)
*/
while (*input) {
int c = 0, len, cursor;
if ((crlf = strpbrk(input, "\r\n")) == NULL)
if ((crlf = strpbrk(input, "\r\n")) == NULL) {
len = strlen(input);
else {
if (len >= CHA_INPUT_SIZE) {
len = CHA_INPUT_SIZE - 1;
crlf = input + CHA_INPUT_SIZE - 2;
c = 0;
}
} else {
len = crlf - input;
c = *crlf;
*crlf = '\0';
Expand Down

0 comments on commit a65e9d3

Please sign in to comment.