aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-08-10 06:21:00 -0700
committerH. Peter Anvin <hpa@zytor.com>2019-08-10 06:21:00 -0700
commitf5d7d90148a9a162d956fd3d7d63fdbff3625f7f (patch)
tree6e56f66614dd2ec2ee5c5a23a95e5ee17ca32b93
parent6686de2bab67b376ba581c3540eec7e7634cea03 (diff)
downloadnasm-f5d7d90148a9a162d956fd3d7d63fdbff3625f7f.tar.gz
nasm-f5d7d90148a9a162d956fd3d7d63fdbff3625f7f.tar.xz
nasm-f5d7d90148a9a162d956fd3d7d63fdbff3625f7f.zip
preproc: fix double free in the handling of %pragma
expand_smacro() consumes its input, so we need to truncate the input list so we can call free_tline(origline) safely. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--asm/preproc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index 56dd4a39..5d95f74a 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -2521,6 +2521,9 @@ static int do_directive(Token *tline, Token **output)
*/
tline = tline->next;
skip_white_(tline);
+ t = tline;
+ tline = tline->next;
+ t->next = NULL;
tline = expand_smacro(tline);
if (tok_type_(tline, TOK_ID)) {
if (!nasm_stricmp(tline->text, "preproc")) {