From f23d3734faf0d0783a394d760f5c384fdf45ef92 Mon Sep 17 00:00:00 2001 From: Fl0-0 Date: Wed, 19 Sep 2018 15:42:56 +0200 Subject: [PATCH] Fix error in error.c --- client/jansson/error.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/jansson/error.c b/client/jansson/error.c index cbd50d7e..b94b3a3a 100644 --- a/client/jansson/error.c +++ b/client/jansson/error.c @@ -25,10 +25,10 @@ void jsonp_error_set_source(json_error_t *error, const char *source) length = strlen(source); if(length < JSON_ERROR_SOURCE_LENGTH) - strncpy(error->source, source, length + 1); + strncpy(error->source, source, JSON_ERROR_SOURCE_LENGTH); else { size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4; - strncpy(error->source, "...", 3); + memcpy(error->source, "...", 3); strncpy(error->source + 3, source + extra, length - extra + 1); } }