From 79e74ffae59e163dd33c5cae228bab23d2179331 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?=
 =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?=
 <erik@darapsa.co.id>
Date: Fri, 11 Jun 2021 18:33:31 +0800
Subject: Fix the length of contents copied from cURL

---
 catalog.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/catalog.c b/catalog.c
index 77d5030..91fe952 100644
--- a/catalog.c
+++ b/catalog.c
@@ -29,9 +29,9 @@ size_t icclient_catalog_results(void *contents, size_t size, size_t nmemb, void
 #endif
 		;
 #ifndef __EMSCRIPTEN__
-	char data[realsize];
-	memcpy(data, contents, realsize - 1);
-	data[realsize - 1] = '\0';
+	char data[realsize + 1];
+	memcpy(data, contents, realsize);
+	data[realsize] = '\0';
 #endif
 	json_object *products = json_tokener_parse_ex(tokener,
 #ifdef __EMSCRIPTEN__
@@ -118,5 +118,4 @@ void icclient_catalog_free(struct icclient_catalog *catalog)
 	free(catalog);
 	catalog = NULL;
 	json_tokener_free(tokener);
-
 }
-- 
cgit v1.2.3