diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 3cadc252dd8977f4117419db240ac87183e54bea..ac3c59e7da1654292c9d1c13525ad84a166b6160 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -3521,7 +3521,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;