properly handle the single null-byte file (closes #24022)

This commit is contained in:
Benjamin Peterson 2016-09-18 23:41:11 -07:00
parent 354c2f90a1
commit 26d998cfdd

View file

@ -1014,7 +1014,7 @@ tok_nextc(struct tok_state *tok)
else {
tok->done = E_OK;
tok->inp = strchr(tok->buf, '\0');
done = tok->inp[-1] == '\n';
done = tok->inp == tok->buf || tok->inp[-1] == '\n';
}
}
else {