mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
Fix NULL dereferences on %substr missing operands
%substr with dangling id issues SIGSEV. Fix it. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
@@ -3395,12 +3395,13 @@ issue_error:
|
|||||||
tline = expand_smacro(tline->next);
|
tline = expand_smacro(tline->next);
|
||||||
last->next = NULL;
|
last->next = NULL;
|
||||||
|
|
||||||
|
if (tline) /* skip expanded id */
|
||||||
t = tline->next;
|
t = tline->next;
|
||||||
while (tok_type_(t, TOK_WHITESPACE))
|
while (tok_type_(t, TOK_WHITESPACE))
|
||||||
t = t->next;
|
t = t->next;
|
||||||
|
|
||||||
/* t should now point to the string */
|
/* t should now point to the string */
|
||||||
if (t->type != TOK_STRING) {
|
if (!tok_type_(t, TOK_STRING)) {
|
||||||
error(ERR_NONFATAL,
|
error(ERR_NONFATAL,
|
||||||
"`%%substr` requires string as second parameter");
|
"`%%substr` requires string as second parameter");
|
||||||
free_tlist(tline);
|
free_tlist(tline);
|
||||||
|
Reference in New Issue
Block a user