]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
If delim string has only one character don't run over end of string.
authorUlrich Drepper <drepper@redhat.com>
Sun, 19 Dec 1999 17:09:29 +0000 (17:09 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sun, 19 Dec 1999 17:09:29 +0000 (17:09 +0000)
sysdeps/generic/strsep.c

index 7ca44f3c3a0dc530d6b4166ebd94e26ed7a1b766..004d8d8ac26f6d01039b98bc73d1f1d6aa01a432 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,6 +43,8 @@ __strsep (char **stringp, const char *delim)
        {
          if (*begin == ch)
            end = begin;
+         else if (*begin == '\0')
+           end = NULL;
          else
            end = strchr (begin + 1, ch);
        }