From f99ddb5bce618bf469961c1235de402dc4bba703 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Mon, 3 Aug 2020 21:42:58 +0200 Subject: prefix every generated json string with the length of itself in bytes Signed-off-by: Toni Uhlig --- nDPId.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nDPId.c') diff --git a/nDPId.c b/nDPId.c index e3a886132..be69b55e8 100644 --- a/nDPId.c +++ b/nDPId.c @@ -680,7 +680,8 @@ static void send_to_json_sink(struct nDPId_reader_thread * const reader_thread, int s_ret; char newline_json_str[BUFSIZ]; - s_ret = snprintf(newline_json_str, sizeof(newline_json_str), "%.*s\n", (int)json_str_len, json_str); + s_ret = snprintf(newline_json_str, sizeof(newline_json_str), "%zu%.*s\n", + json_str_len, (int)json_str_len, json_str); if (s_ret < 0 || s_ret > (int)sizeof(newline_json_str)) { syslog(LOG_DAEMON | LOG_ERR, -- cgit v1.2.3