On Thu, Aug 24, 2017 at 8:29 PM, Justin Cinkelj <justin.cink...@xlab.si> wrote: > memcpy had of-by-one error. > Also, remove unneeded defines. > > Signed-off-by: Justin Cinkelj <justin.cink...@xlab.si> > --- > libc/string/stresep.c | 16 ++-------------- > 1 file changed, 2 insertions(+), 14 deletions(-) > > diff --git a/libc/string/stresep.c b/libc/string/stresep.c > index 4d72391..5ac4b85 100644 > --- a/libc/string/stresep.c > +++ b/libc/string/stresep.c > @@ -30,22 +30,10 @@ > */ > > #include <sys/cdefs.h> > -#if defined(LIBC_SCCS) && !defined(lint) > -#if 0 > -static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; > -#else > -__RCSID("$NetBSD: stresep.c,v 1.3 2017/02/12 17:19:00 maya Exp $"); > -#endif > -#endif /* LIBC_SCCS and not lint */ > - > -#include "namespace.h"
The "namespace.h" is worse than unneeded, it will prevent the code from compiling, and break bisectability. If you want to commit an unmodified source file first, I suggest that in the first patch don't add it to the Makefile, and only add it to the Makefile in this patch, after you fix the source file to compile. > > #include <assert.h> > #include <string.h> > - > -#ifdef __weak_alias > -__weak_alias(stresep,_stresep) > -#endif > +#define _DIAGASSERT assert > > /* > * Get next token from string *stringp, where tokens are possibly-empty > @@ -76,7 +64,7 @@ stresep(char **stringp, const char *delim, int esc) > for (tok = s;;) { > c = *s++; > while (esc != '\0' && c == esc) { > - memmove(s - 1, s, strlen(s)); > + memmove(s - 1, s, strlen(s) + 1); This is troubling - how could Netbsd have such a basic bug? (I don't know what this code is doing, though...). > c = *s++; > } > spanp = delim; > -- > 2.9.4 > > -- > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to osv-dev+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.