summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authormaya <maya@NetBSD.org>2017-02-12 17:19:00 +0000
committermaya <maya@NetBSD.org>2017-02-12 17:19:00 +0000
commitdf7c7d3967a56687223e45c751de5d9005cfd8eb (patch)
tree2b01e172211c70765d9019ce0f0bd960f1bddf96 /lib/libc/string
parent2a2533ec342db56e5948bb506b7297b6ca388a4b (diff)
overlapping strcpy is UB. use memmove
from asan+ubsan
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/stresep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/string/stresep.c b/lib/libc/string/stresep.c
index 34946d4409c..4d72391b365 100644
--- a/lib/libc/string/stresep.c
+++ b/lib/libc/string/stresep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: stresep.c,v 1.2 2007/12/06 22:07:07 seb Exp $ */
+/* $NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: stresep.c,v 1.2 2007/12/06 22:07:07 seb Exp $");
+__RCSID("$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -76,7 +76,7 @@ stresep(char **stringp, const char *delim, int esc)
for (tok = s;;) {
c = *s++;
while (esc != '\0' && c == esc) {
- (void)strcpy(s - 1, s);
+ memmove(s - 1, s, strlen(s));
c = *s++;
}
spanp = delim;