Module Name: src
Committed By: maya
Date: Sun Feb 12 17:19:00 UTC 2017
Modified Files:
src/lib/libc/string: stresep.c
Log Message:
overlapping strcpy is UB. use memmove
from asan+ubsan
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/string/stresep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/string/stresep.c
diff -u src/lib/libc/string/stresep.c:1.2 src/lib/libc/string/stresep.c:1.3
--- src/lib/libc/string/stresep.c:1.2 Thu Dec 6 22:07:07 2007
+++ src/lib/libc/string/stresep.c Sun Feb 12 17:19:00 2017
@@ -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 *deli
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;