mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
preproc.: Fix NULL dereference on broken %strlen argument
Under particular circumstances %strlen may cause SIGSEG. A typical example is %strlen with nonexistent macro argument. [ Testcase test/strlen.asm ] Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
077fb93d2b
commit
4e1d5ab0cf
@ -3254,7 +3254,7 @@ issue_error:
|
||||
while (tok_type_(t, TOK_WHITESPACE))
|
||||
t = t->next;
|
||||
/* t should now point to the string */
|
||||
if (t->type != TOK_STRING) {
|
||||
if (!tok_type_(t, TOK_STRING)) {
|
||||
error(ERR_NONFATAL,
|
||||
"`%%strlen` requires string as second parameter");
|
||||
free_tlist(tline);
|
||||
|
5
test/strlen.asm
Normal file
5
test/strlen.asm
Normal file
@ -0,0 +1,5 @@
|
||||
%macro strlen_test 1
|
||||
%strlen len %2 ; not existing argument
|
||||
%endmacro
|
||||
|
||||
strlen_test 'a'
|
Loading…
Reference in New Issue
Block a user