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.
master
Yuya Nishihara 4 years ago committed by Simon Ser
parent b36af22c94
commit a71d565138

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

Loading…
Cancel
Save