@@ -232,9 +232,14 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
MAX_CMD_LEN, cmd ? cmd : "none");
break;
case RTE_TEL_STRING:
- used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":\"%.*s\"}",
- MAX_CMD_LEN, cmd,
- RTE_TEL_MAX_SINGLE_STRING_LEN, d->data.str);
+ prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":",
+ MAX_CMD_LEN, cmd);
+ cb_data_buf = &out_buf[prefix_used];
+ buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */
+
+ used = rte_tel_json_str(cb_data_buf, buf_len, 0, d->data.str);
+ used += prefix_used;
+ used += strlcat(out_buf + used, "}", sizeof(out_buf) - used);
break;
case RTE_TEL_DICT:
prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":",
When returning just a string in response to a query, use the proper json string printing function to escape characters rather than just snprintf. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> --- lib/telemetry/telemetry.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)