From 3c5cc02b18a67968974f534c91d289ea658c9d2d Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sat, 10 Apr 2021 15:31:06 +0900 Subject: [PATCH] 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. --- xcursor/xcursor.c | 5 +---- 1 file changed, 1 insertion(+), 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 *