fix reads of out-of-bounds values in tokenizer.h

This commit is contained in:
Joel Dice 2012-09-12 15:25:17 -06:00
parent c918cbced1
commit 2190d0e99a

View File

@ -32,13 +32,13 @@ class Tokenizer {
{ } { }
bool hasMore() { bool hasMore() {
while (*s == delimiter and s != limit) ++s; while (s != limit and *s == delimiter) ++s;
return *s != 0 and s != limit; return s != limit and *s != 0;
} }
Token next() { Token next() {
const char* p = s; const char* p = s;
while (*s and *s != delimiter and s != limit) ++s; while (s != limit and *s and *s != delimiter) ++s;
return Token(p, s - p); return Token(p, s - p);
} }