[PATCH] telemetry: fix JSON string formatter
David Marchand
david.marchand at redhat.com
Thu May 25 09:20:35 CEST 2023
For large strings, we were incorrectly copying uninitialised data to the
output buffer.
Restore previous code.
Fixes: a515b7204e28 ("telemetry: remove VLA in JSON string formatter")
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
lib/telemetry/telemetry_json.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h
index 7999535848..7a246deacb 100644
--- a/lib/telemetry/telemetry_json.h
+++ b/lib/telemetry/telemetry_json.h
@@ -153,7 +153,7 @@ __json_format_str(char *buf, const int len, const char *prefix, const char *str,
ret = __json_format_str_to_buf(tmp, len, prefix, str, suffix);
if (ret > 0)
- strcpy(buf, saved);
+ strcpy(buf, tmp);
free(tmp);
return ret;
--
2.40.1
More information about the dev
mailing list