diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 4fd45be95a43..13a2251a37c5 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3544,7 +3544,7 @@ perf_event__synthesize_event_update_unit(struct perf_tool *tool, if (ev == NULL) return -ENOMEM; - strncpy(ev->data, evsel->unit, size); + strlcpy(ev->data, evsel->unit, size + 1); err = process(tool, (union perf_event *)ev, NULL, NULL); free(ev); return err;