Re: [PATCH 3/4] rt-tests: deadline_tests: fix stack buffer flow

John Kacur
2019-04-05T14:35:37Z

> The appended string is actually longer than 14 characters. Use strlen() to
> compute the correct length like the other functions do.
>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
> src/sched_deadline/deadline_test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
> index b213c206559c..4826557d0624 100644
> --- a/src/sched_deadline/deadline_test.c
> +++ b/src/sched_deadline/deadline_test.c
> @@ -435,7 +435,7 @@ static void setup_ftrace_marker(void)
> {
> struct stat st;
> const char *debugfs = find_debugfs();
> - char files[strlen(debugfs) + 14];
> + char files[strlen(debugfs) + strlen("/tracing/trace_marker") + 1];
> int ret;
>
> if (strlen(debugfs) == 0)
> --
> 2.11.0
>
>
Signed-off-by: John Kacur <jkacur@redhat.com>