From 597cb1874068054d4c0be41f161a72ef37888930 Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Tue, 26 Feb 2019 09:17:37 +0100 Subject: New upstream version 17.11.5 Change-Id: I8d2aa1aee2a9a78614dff5a01008f91e88e810c7 Signed-off-by: Christian Ehrhardt --- app/proc_info/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/proc_info/main.c') diff --git a/app/proc_info/main.c b/app/proc_info/main.c index 875d91ea..2893bec6 100644 --- a/app/proc_info/main.c +++ b/app/proc_info/main.c @@ -517,14 +517,18 @@ nic_xstats_display(uint16_t port_id) if (enable_collectd_format) { char counter_type[MAX_STRING_LEN]; char buf[MAX_STRING_LEN]; + size_t n; collectd_resolve_cnt_type(counter_type, sizeof(counter_type), xstats_names[i].name); - sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%" + n = snprintf(buf, MAX_STRING_LEN, + "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%" PRIu64"\n", host_id, port_id, counter_type, xstats_names[i].name, values[i]); - ret = write(stdout_fd, buf, strlen(buf)); + if (n > sizeof(buf) - 1) + n = sizeof(buf) - 1; + ret = write(stdout_fd, buf, n); if (ret < 0) goto err; } else { -- cgit 1.2.3-korg