From 21599b95f8228525e8e2135d74aad0137e0d5613 Mon Sep 17 00:00:00 2001 From: Olivier Langlois Date: Tue, 27 Aug 2013 22:47:18 -0400 Subject: [PATCH] Replace strcpy with memcpy Since len is known, the copy function does not need to check byte by byte the end of the string. Signed-off-by: Olivier Langlois --- src/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memory.c b/src/memory.c index a3d9aaf..eb6cec5 100644 --- a/src/memory.c +++ b/src/memory.c @@ -45,7 +45,7 @@ char *jsonp_strdup(const char *str) if(!new_str) return NULL; - strcpy(new_str, str); + memcpy(new_str, str, len + 1); return new_str; }