mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-30 16:41:05 +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
35519d6719
commit
a26efa45d8
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