Browse Source

In general it is a bad idea to compare memory. We should compare strings and check its length. Fixes #34.

pull/44/head
Rafal Kupiec 3 years ago
parent
commit
e0b939d9a2
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      engine/lexer.c

+ 1
- 1
engine/lexer.c View File

@ -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…
Cancel
Save