mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 12:28:07 +02:00
gallium/hud: avoid buffer overrun
Renaming data sources was added in
e8bb97ce30
It was possible to use a new name longer than
the name array in hud_graph of 128. This
patch truncates the name to fit the array.
CC: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
parent
0d9a4efce9
commit
8daf6de3de
1 changed files with 4 additions and 2 deletions
|
|
@ -1275,8 +1275,10 @@ hud_parse_env_var(struct hud_context *hud, const char *env)
|
|||
|
||||
strip_hyphens(s);
|
||||
if (!LIST_IS_EMPTY(&pane->graph_list)) {
|
||||
strcpy(LIST_ENTRY(struct hud_graph,
|
||||
pane->graph_list.prev, head)->name, s);
|
||||
struct hud_graph *graph;
|
||||
graph = LIST_ENTRY(struct hud_graph, pane->graph_list.prev, head);
|
||||
strncpy(graph->name, s, sizeof(graph->name)-1);
|
||||
graph->name[sizeof(graph->name)-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue