gallium/hud: avoid overflowing hud graph name size

Spotted by Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Ilia Mirkin 2015-03-26 19:37:50 -04:00
parent 9d1b5febb6
commit 2e34faaf06
1 changed files with 2 additions and 1 deletions

View File

@ -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);