aboutsummaryrefslogtreecommitdiff
path: root/xcursor
diff options
context:
space:
mode:
authorYuya Nishihara <yuya@tcha.org>2021-04-10 15:26:24 +0900
committerSimon Ser <contact@emersion.fr>2021-04-13 16:55:46 +0200
commita71d565138b5100ebfbac99293bc467d0fc21ef6 (patch)
treecbb15ea3255bbfb5e686d874406392a1c2dd8b15 /xcursor
parentb36af22c94ea8e02616f5ab0ca06001f41f69a49 (diff)
Revert "xcursor: use strncat instead of strncpy"
This reverts commit 7dffe9339bf8a92a556098d86712c4c38ac95226, 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.
Diffstat (limited to 'xcursor')
-rw-r--r--xcursor/xcursor.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xcursor/xcursor.c b/xcursor/xcursor.c
index acb2e1a8..d33dee28 100644
--- a/xcursor/xcursor.c
+++ b/xcursor/xcursor.c
@@ -655,7 +655,11 @@ _XcursorAddPathElt (char *path, const char *elt, int len)
elt++;
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 *