Skip to content

Commit

Permalink
use strncmp instead of memcmp to avoid ASAN complaining
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyendumajumdar committed Jan 1, 2016
1 parent 7649833 commit f2a88ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ravi-tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ then
exit 1
fi

echo "======================================="

$LUA gaussian2.lua
if [ $? != 0 ]
then
Expand Down
10 changes: 5 additions & 5 deletions src/llex.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,17 +478,17 @@ static int casttoken(LexState *ls, SemInfo *seminfo) {
int tok;

/* @integer or @integer[] */
if (memcmp(s, "@integer", n) == 0)
if (strncmp(s, "@integer", n) == 0)
tok = TK_TO_INTEGER;
else if (memcmp(s, "@integer[]", n) == 0)
else if (strncmp(s, "@integer[]", n) == 0)
tok = TK_TO_INTARRAY;
/* @number or @number[] */
else if (memcmp(s, "@number", n) == 0)
else if (strncmp(s, "@number", n) == 0)
tok = TK_TO_NUMBER;
else if (memcmp(s, "@number[]", n) == 0)
else if (strncmp(s, "@number[]", n) == 0)
tok = TK_TO_NUMARRAY;
/* @table */
else if (memcmp(s, "@table", n) == 0)
else if (strncmp(s, "@table", n) == 0)
tok = TK_TO_TABLE;
else {
seminfo->ts = luaX_newstring(ls, s, n);
Expand Down

0 comments on commit f2a88ca

Please sign in to comment.