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.
This commit is contained in:
Yuya Nishihara 2021-04-10 15:31:06 +09:00 committed by Simon Ser
parent a71d565138
commit 3c5cc02b18

View file

@ -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 *