drh / lcc

The lcc retargetable ANSI C compiler
https://drh.github.io/lcc/
2.03k stars 442 forks source link

lburg - fix strchr when buffer doesn't have an eol. #23

Open ksherlock opened 9 years ago

ksherlock commented 9 years ago

if strchr(bp, '\n') didn't find anything the first time, it won't find anything the second time, either. Change to'\0' to find the end-of-line. It's still a syntax error (the grammar requires a '\n') but it won't cause an alloc error.

This is only an issue if there's no end-of-line while lexing a rule's cost code (so not a problem with any of lcc's files).