summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-09-07 09:52:47 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-09-07 20:54:39 +0400
commite165c1b69a3408afbbcdabc5ad57f7d71f37dbe6 (patch)
tree049d219975189c8f099cc93a674dc644fe5303d4
parent49cd6fbccf0414950b03555bb2efbb0c4dc163c0 (diff)
downloadnasm-e165c1b69a3408afbbcdabc5ad57f7d71f37dbe6.tar.gz
nasm_quote: Use memcpy only if length provided
No need to call memcpy on empty strings Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--quote.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/quote.c b/quote.c
index 2cb55b14..e45dfb29 100644
--- a/quote.c
+++ b/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);