X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_dpdk.c;h=fbdcaf8832a5d843d29cc242318f83e8c1a95109;hb=c7ab57a44a8bbfc17fa4d184f2c66eae03451f2a;hp=2f37818bfcc73044f2f4641eb6a88dcd5b4004ea;hpb=23fadd68220155b7a2c124f68c54357450d76581;p=collectd.git diff --git a/src/utils_dpdk.c b/src/utils_dpdk.c index 2f37818b..fbdcaf88 100644 --- a/src/utils_dpdk.c +++ b/src/utils_dpdk.c @@ -45,7 +45,9 @@ #define DPDK_DEFAULT_RTE_CONFIG "/var/run/.rte_config" #define DPDK_EAL_ARGC 10 -// Complete trace should fit into 1024 chars +// Complete trace should fit into 1024 chars. Trace contain some headers +// and text together with traced data from pipe. This is the reason why +// we need to limit DPDK_MAX_BUFFER_SIZE value. #define DPDK_MAX_BUFFER_SIZE 896 #define DPDK_CDM_DEFAULT_TIMEOUT 10000 @@ -731,8 +733,8 @@ static void dpdk_helper_check_pipe(dpdk_helper_ctx_t *phc) { DEBUG("%s:dpdk_helper_check_pipe: read nbytes=%d", phc->shm_name, nbytes); if (nbytes <= 0) break; - buf[nbytes] = '\n'; - sstrncpy(out, buf, (nbytes + 1)); + buf[nbytes] = '\0'; + sstrncpy(out, buf, sizeof(out)); DEBUG("%s: helper process:\n%s", phc->shm_name, out); } }