summaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-10-17 18:22:43 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-10-17 18:22:43 -0700
commitf770ce8be48f17b772c3a9c32b3da944e155f502 (patch)
treeebc168f4e9bdc722bc1bb7882807f2e52f8fc7bc /asm
parent18f413422221063d524f7a5b08bece5f8604af27 (diff)
downloadnasm-f770ce8be48f17b772c3a9c32b3da944e155f502.tar.gz
preproc: reserve space for terminal NUL in %strcat
Technically, this is not necessary, because make_tok_qstr_len() doesn't rely on NUL termination, and in fact it *can't*, since the string might contain embedded NULs, but tacking on a NUL is good for debugging if nothing else. That means reserving space for it! Reported-by: C. Masloch <pushbx@ulukai.org> Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'asm')
-rw-r--r--asm/preproc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index c3353951..d966c10f 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -4234,7 +4234,7 @@ issue_error:
}
}
- q = qbuf = nasm_malloc(len);
+ q = qbuf = nasm_malloc(len+1);
list_for_each(t, tline) {
if (t->type == TOK_INTERNAL_STRING)
q = mempcpy(q, tok_text(t), t->len);