Re: perf_counter: buffer overwrite problem for perf top command

From: Ingo Molnar
Date: Sun May 10 2009 - 02:23:24 EST



* Erdem Aktas <eaktas1@xxxxxxxxx> wrote:

> Hi;
> There is a buffer overwrite problem in builtin-top.c line 526, When I
> tried to use ./perf top command, it was giving memory corruption
> problem. should not we use malloc(strlen(str)+1) ?

indeed, well spotted - we do an strcpy into that buffer so the \0 at
the end of the string has to be allocated too.

I've applied it to tip:perfcounters/core and tip/master and pushed
it out. Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/