X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Fproc-info%2Fmain.c;h=c20effa4f77383a7dac2c834b131eac80da58679;hb=45cc346bc96a4e0b9a179893c110c94775a0909e;hp=539e132433035c6f0ffa79d5db80e312e7794661;hpb=d9a42a69febf453cdb735e77fc0e01463ddf4acc;p=dpdk.git diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 539e132433..c20effa4f7 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -488,14 +488,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 {