In general it is a bad idea to compare memory. We should compare strings and check its length. Fixes #34.
This commit is contained in:
parent
19f8cf2599
commit
e0b939d9a2
|
@ -639,7 +639,7 @@ static sxu32 KeywordCode(const char *z, int n) {
|
|||
return PH7_TK_ID;
|
||||
} else {
|
||||
for(ph7_token *pToken = pTokenLookup; pToken != pTokenLookup + sizeof(pTokenLookup) / sizeof(pTokenLookup[0]); pToken++) {
|
||||
if(SyMemcmp(pToken->token, z, n) == 0) {
|
||||
if(n == SyStrlen(pToken->token) && SyStrncmp(pToken->token, z, n) == 0) {
|
||||
return pToken->value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue