diff options
author | Adam Majer <amajer@suse.de> | 2017-07-25 11:12:35 +0200 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2017-08-16 14:58:53 -0700 |
commit | 1a069438efa890b31edeed131c7e2a6cc783e2c1 (patch) | |
tree | 6e9e1f17ac378039ddec68976b2e2fcab34412f4 | |
parent | 24f7b5c3e4e357b2cd6d4bd16703e6eb3be1c59e (diff) | |
download | nasm-1a069438efa890b31edeed131c7e2a6cc783e2c1.tar.gz |
preproc: Only concat tok->text if we accounted for its size
https://bugzilla.nasm.us/show_bug.cgi?id=3392415
Signed-off-by: Adam Majer <amajer@suse.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | asm/preproc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/asm/preproc.c b/asm/preproc.c index 97e87d2c..22c90f2b 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -3845,9 +3845,15 @@ static bool paste_tokens(Token **head, const struct tokseq_match *m, len += strlen(tok->text); p = buf = nasm_malloc(len + 1); + strcpy(p, tok->text); + p = strchr(p, '\0'); + tok = delete_Token(tok); + while (tok != next) { - strcpy(p, tok->text); - p = strchr(p, '\0'); + if (PP_CONCAT_MATCH(tok, m[i].mask_tail)) { + strcpy(p, tok->text); + p = strchr(p, '\0'); + } tok = delete_Token(tok); } |