[Mesa-dev] [PATCH v1 3/3] gallium/hud: Prevent buffer overflow in hud_thread_busy_install

Gustaw Smolarczyk wielkiegie at gmail.com
Thu Jun 29 08:17:35 UTC 2017


2017-06-29 4:41 GMT+02:00 Robert Foss <robert.foss at collabora.com>:
> Switch to using strncopy to avoid potential overflow of
> name array in struct hud_graph.
>
> Coverity-id: 1413760
>
> Signed-off-by: Robert Foss <robert.foss at collabora.com>
> ---
>  src/gallium/auxiliary/hud/hud_cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/hud/hud_cpu.c b/src/gallium/auxiliary/hud/hud_cpu.c
> index 468c36207b..ceadccb377 100644
> --- a/src/gallium/auxiliary/hud/hud_cpu.c
> +++ b/src/gallium/auxiliary/hud/hud_cpu.c
> @@ -288,7 +288,7 @@ hud_thread_busy_install(struct hud_pane *pane, const char *name, bool main)
>     if (!gr)
>        return;
>
> -   strcpy(gr->name, name);
> +   strcpy(gr->name, name, HUD_GRAPH_NAME_LEN);

strncpy?

Regards,
Gustaw


More information about the mesa-dev mailing list