aboutsummaryrefslogtreecommitdiff
path: root/examples/screencopy-dmabuf.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-06-11 15:27:04 +0200
committerDrew DeVault <sir@cmpwn.com>2020-06-11 07:34:55 -0600
commit4615ce9099b10a4325936cd57f1ca253fc5fcc2d (patch)
treec7fed2c127644eae210ebc845a0caa26a7cb226d /examples/screencopy-dmabuf.c
parent7f9bbaaa17851ba7ee204fc4755ad509e06a9b07 (diff)
examples/screencopy-dmabuf: call strncpy with maxlen - 1
The original code wasn't wrong since we were manually writing a null byte anyway, but this makes GCC happy. Closes: https://github.com/swaywm/wlroots/issues/2273
Diffstat (limited to 'examples/screencopy-dmabuf.c')
-rw-r--r--examples/screencopy-dmabuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/screencopy-dmabuf.c b/examples/screencopy-dmabuf.c
index ea6b9f50..ebc6ea75 100644
--- a/examples/screencopy-dmabuf.c
+++ b/examples/screencopy-dmabuf.c
@@ -87,7 +87,7 @@ static bool find_render_node(char *node, size_t maxlen) {
continue;
}
- strncpy(node, dev->nodes[DRM_NODE_RENDER], maxlen);
+ strncpy(node, dev->nodes[DRM_NODE_RENDER], maxlen - 1);
node[maxlen - 1] = '\0';
r = true;
break;