From: Andrew Bays Date: Thu, 14 Dec 2017 13:40:42 +0000 (-0500) Subject: Use snprintf instead of sprintf X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=65de34fff1c57e1f8a13e504792a33e78a79c316;p=collectd.git Use snprintf instead of sprintf --- diff --git a/src/sysevent.c b/src/sysevent.c index 4da0fd76..d222e48b 100644 --- a/src/sysevent.c +++ b/src/sysevent.c @@ -429,7 +429,7 @@ static void submit(const char *message, yajl_val *node, memset(json_val, '\0', listen_buffer_size); - sprintf(json_val, "%s%c", YAJL_GET_STRING(v), '\0'); + snprintf(json_val, listen_buffer_size, "%s%c", YAJL_GET_STRING(v), '\0'); DEBUG("sysevent plugin: adding jsonval: %s", json_val); @@ -445,7 +445,7 @@ static void submit(const char *message, yajl_val *node, memset(json_val, '\0', listen_buffer_size); - sprintf(json_val, "%s%c", YAJL_GET_STRING(v), '\0'); + snprintf(json_val, listen_buffer_size, "%s%c", YAJL_GET_STRING(v), '\0'); DEBUG("sysevent plugin: adding jsonval: %s", json_val); @@ -512,7 +512,7 @@ static int sysevent_read(void) /* {{{ */ memset(json_val, '\0', listen_buffer_size); - sprintf(json_val, "%s%c", YAJL_GET_STRING(v), '\0'); + snprintf(json_val, listen_buffer_size, "%s%c", YAJL_GET_STRING(v), '\0'); match_str = (char *)&json_val; }