From 15ddc4a504a8b3654b41c60ec7cc277b7bd4d976 Mon Sep 17 00:00:00 2001 From: Eibz-Chan <111971485+Eibz-Chan@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:54:03 +0800 Subject: [PATCH] Unsafe function usage. According to standards for C Language, high Risk to use strcat(). It should be replaced by strncat. --- json_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json_object.c b/json_object.c index 14cd594..8f8705a 100644 --- a/json_object.c +++ b/json_object.c @@ -1047,7 +1047,7 @@ static int json_object_double_to_json_string_format(struct json_object *jso, str { // Ensure it looks like a float, even if snprintf didn't, // unless a custom format is set to omit the decimal. - strcat(buf, ".0"); + strncat(buf, ".0", 2); size += 2; } if (p && (flags & JSON_C_TO_STRING_NOZERO))