From 4ec50658c2a6eb142275cbeceba8e5d6430b2714 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sun, 21 Oct 2012 22:28:42 +0200 Subject: [PATCH] VNOTE: rather use memcpy if we know the length to copy anyways. --- libcitadel/lib/vnote.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcitadel/lib/vnote.c b/libcitadel/lib/vnote.c index 3507a4087..c8f45b98c 100644 --- a/libcitadel/lib/vnote.c +++ b/libcitadel/lib/vnote.c @@ -80,10 +80,10 @@ struct vnote *vnote_new_from_str(char *s) { thisline = NULL; nexteol = strchr(ptr, '\n'); if (nexteol) { - thisline = malloc((nexteol - ptr) + 2); - strncpy(thisline, ptr, (nexteol-ptr)); thisline_len = (nexteol-ptr); - thisline[thisline_len] = 0; + thisline = malloc(thisline_len + 2); + memcpy(thisline, ptr, thisline_len); + thisline[thisline_len] = '\0'; ptr = nexteol + 1; } else { -- 2.30.2