mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-05 05:05:57 +01:00
examples/screencopy-dmabuf: stop using strncpy
strncpy doesn't guarantee that the result is zero-terminated.
This commit is contained in:
parent
366e8e3b91
commit
c2952411d3
1 changed files with 2 additions and 3 deletions
|
@ -76,7 +76,7 @@ static const struct format formats[] = {
|
|||
{DRM_FORMAT_ABGR8888, false},
|
||||
};
|
||||
|
||||
static bool find_render_node(char *node, size_t maxlen) {
|
||||
static bool find_render_node(char *node, size_t node_size) {
|
||||
bool r = false;
|
||||
drmDevice *devices[64];
|
||||
|
||||
|
@ -87,8 +87,7 @@ static bool find_render_node(char *node, size_t maxlen) {
|
|||
continue;
|
||||
}
|
||||
|
||||
strncpy(node, dev->nodes[DRM_NODE_RENDER], maxlen - 1);
|
||||
node[maxlen - 1] = '\0';
|
||||
snprintf(node, node_size, "%s", dev->nodes[DRM_NODE_RENDER]);
|
||||
r = true;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue