summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <[email protected]>2017-01-15 00:28:54 +0100
committerMarek Olšák <[email protected]>2017-01-16 18:07:08 +0100
commit8daf6de3deddef8f71f8b1af61b12cd8cb783433 (patch)
tree49085a79b0d2588576be988ab83932cba1cbeda6 /src
parent0d9a4efce9c7503544fb828b225ea32a11bc799b (diff)
gallium/hud: avoid buffer overrun
Renaming data sources was added in e8bb97ce30051b999a4a69c9b27884daeb8d71e6 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 <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/hud/hud_context.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index fd9a7bc2fcb..a635797328d 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -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;
}
}