[Mesa-dev] [PATCH] gallium/hud: avoid overflowing hud graph name size
Marek Olšák
maraeo at gmail.com
Thu Mar 26 16:45:31 PDT 2015
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Fri, Mar 27, 2015 at 12:37 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> Spotted by Coverity.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> src/gallium/auxiliary/hud/hud_driver_query.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/hud/hud_driver_query.c b/src/gallium/auxiliary/hud/hud_driver_query.c
> index b48708c..53771fc 100644
> --- a/src/gallium/auxiliary/hud/hud_driver_query.c
> +++ b/src/gallium/auxiliary/hud/hud_driver_query.c
> @@ -157,7 +157,8 @@ hud_pipe_query_install(struct hud_pane *pane, struct pipe_context *pipe,
> if (!gr)
> return;
>
> - strcpy(gr->name, name);
> + strncpy(gr->name, name, sizeof(gr->name));
> + gr->name[sizeof(gr->name) - 1] = '\0';
> gr->query_data = CALLOC_STRUCT(query_info);
> if (!gr->query_data) {
> FREE(gr);
> --
> 2.0.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list