mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 19:30:12 +01:00
gallium/hud: use snprintf(..., "%s", ...) instead of strncpy
This fixes a warning with stringop-truncation:
```
error: 'strncpy' output may be truncated copying 127 bytes from a string of length 255 [-Werror=stringop-truncation]
1443 | strncpy(graph->name, s, sizeof(graph->name)-1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18613>
This commit is contained in:
parent
9718c88baf
commit
4a1bde9fb0
1 changed files with 1 additions and 2 deletions
|
|
@ -1443,8 +1443,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
|
|||
if (added && !list_is_empty(&pane->graph_list)) {
|
||||
struct hud_graph *graph;
|
||||
graph = list_entry(pane->graph_list.prev, struct hud_graph, head);
|
||||
strncpy(graph->name, s, sizeof(graph->name)-1);
|
||||
graph->name[sizeof(graph->name)-1] = 0;
|
||||
snprintf(graph->name, sizeof(graph->name), "%s", s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue