On Wed, Oct 28, 2020 at 4:17 PM David Marchand <david.march...@redhat.com> wrote: > This fixes it: > @@ -37,11 +37,12 @@ meta_copy(char **meta, int *offset, char *str, int rc) > if (rc < 0) > return rc; > > - ptr = realloc(ptr, count + rc); > + ptr = realloc(ptr, count + rc + 1); > if (ptr == NULL) > goto free_str; > > memcpy(RTE_PTR_ADD(ptr, count), str, rc); > + ptr[count + rc] = '\0'; > count += rc; > free(str); >
The other alternative is to prefer libc string formatting functions rather than plain memory alloc + copy + manual null termination: https://github.com/david-marchand/dpdk/commit/traces -- David Marchand