Re: [PATCH v2] dio: Fix buffer overflow in case of unknown board

From: Geert Uytterhoeven
Date: Mon Jan 21 2019 - 04:44:13 EST


On Mon, Jan 21, 2019 at 10:24 AM Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
> With gcc 8.2.0:
>
> drivers/dio/dio.c: In function âdio_initâ:
> drivers/dio/dio.c:240:17: warning: âstrcpyâ writing 69 or more bytes into a region of size 64 overflows the destination [-Wstringop-overflow=]
> strcpy(dev->name,dio_getname(dev->id));
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Indeed, if an unknown board is present, the target buffer will overflow.
> Shorten the unknown board name string to fix this, and declare it as an
> array while at it.
>
> Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>

Thanks, applied and queued for v5.1.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds