Skip to content

Commit

Permalink
Fix memcmp size argument off by one
Browse files Browse the repository at this point in the history
The `"true"` string has 4 bytes so `memcmp(p2, "true", 3)` should be `memcmp(p2, "true", 4)`
  • Loading branch information
disconnect3d authored and realnc committed Feb 10, 2020
1 parent f7ba49f commit 52c09ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tads3/vmbiftad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2181,7 +2181,7 @@ void CVmBifTADS::toIntOrNum(VMG_ uint argc, int int_only)
/* the value for "nil" is 0 */
retval_int(vmg_ 0);
}
else if (len2 == 4 && memcmp(p2, "true", 3) == 0)
else if (len2 == 4 && memcmp(p2, "true", 4) == 0)
{
/* the value for "true" is 1 */
retval_int(vmg_ 1);
Expand Down

0 comments on commit 52c09ea

Please sign in to comment.