aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuya Nishihara <yuya@tcha.org>2021-04-10 15:31:06 +0900
committerSimon Ser <contact@emersion.fr>2021-04-13 16:55:46 +0200
commit3c5cc02b18a67968974f534c91d289ea658c9d2d (patch)
tree53db9b8660d49ab6f86da8d63a3c710146039bd1
parenta71d565138b5100ebfbac99293bc467d0fc21ef6 (diff)
xcursor: use memcpy() to append string of known size
Since len <= strlen(elt) is known, we don't need a str*() function. Let's simply do memcpy() to suppress linter false positive. Fixes #2777.
-rw-r--r--xcursor/xcursor.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/xcursor/xcursor.c b/xcursor/xcursor.c
index d33dee28..5c4538a2 100644
--- a/xcursor/xcursor.c
+++ b/xcursor/xcursor.c
@@ -655,11 +655,8 @@ _XcursorAddPathElt (char *path, const char *elt, int len)
elt++;
len--;
}
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstringop-truncation"
- strncpy (path + pathlen, elt, len);
+ memcpy (path + pathlen, elt, len);
path[pathlen + len] = '\0';
-#pragma GCC diagnostic pop
}
static char *