Skip to content

Commit 5e40896

Browse files
committed
Fix a buffer overflow
Fixes #635 Thanks to HongxuChen for reporting it
1 parent dd7b2fe commit 5e40896

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: liblouis/lou_translateString.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ matchCurrentInput(
354354
const InString *input, int pos, const widechar *passInstructions, int passIC) {
355355
int k;
356356
int kk = pos;
357-
for (k = passIC + 2; k < passIC + 2 + passInstructions[passIC + 1]; k++)
357+
for (k = passIC + 2;
358+
((k < passIC + 2 + passInstructions[passIC + 1]) && (kk < input->length));
359+
k++)
358360
if (input->chars[kk] == ENDSEGMENT || passInstructions[k] != input->chars[kk++])
359361
return 0;
360362
return 1;

0 commit comments

Comments
 (0)