mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
nasm_quote: Use memcpy only if length provided
No need to call memcpy on empty strings Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
49cd6fbccf
commit
e165c1b69a
3
quote.c
3
quote.c
@ -108,7 +108,8 @@ char *nasm_quote(char *str, size_t len)
|
||||
nstr = nasm_malloc(len+3);
|
||||
nstr[0] = nstr[len+1] = sq_ok ? '\'' : '\"';
|
||||
nstr[len+2] = '\0';
|
||||
memcpy(nstr+1, str, len);
|
||||
if (len > 0)
|
||||
memcpy(nstr+1, str, len);
|
||||
} else {
|
||||
/* Need to use `...` quoted syntax */
|
||||
nstr = nasm_malloc(qlen+3);
|
||||
|
Loading…
Reference in New Issue
Block a user