From e165c1b69a3408afbbcdabc5ad57f7d71f37dbe6 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 7 Sep 2010 09:52:47 +0400 Subject: [PATCH] nasm_quote: Use memcpy only if length provided No need to call memcpy on empty strings Signed-off-by: Cyrill Gorcunov --- quote.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.11.4.GIT