Revert "xcursor: use strncat instead of strncpy"

This reverts commit 7dffe9339b, which introduced
another linter error with -O3:

  error: ‘strncat’ specified bound 7 equals source length [-Werror=stringop-overflow=]

This makes sense because strncat(dest, "cursors", strlen("cursors")) is moot
in security point of view.

The next commit will replace strncpy() with memcpy(), so let's restore the
original implementation.
This commit is contained in:
Yuya Nishihara 2021-04-10 15:26:24 +09:00 committed by Simon Ser
parent b36af22c94
commit a71d565138

View file

@ -655,7 +655,11 @@ _XcursorAddPathElt (char *path, const char *elt, int len)
elt++; elt++;
len--; len--;
} }
strncat (path + pathlen, elt, len); #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (path + pathlen, elt, len);
path[pathlen + len] = '\0';
#pragma GCC diagnostic pop
} }
static char * static char *