libc -- string: strspn should return 0 for empty match strings, not string len.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Wed, 26 Oct 2011 14:37:39 +0000 (07:37 -0700)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Wed, 26 Oct 2011 14:37:39 +0000 (07:37 -0700)
Reported-by: lentferj
lib/libc/string/strspn.c

index 0e20e9d..445c4b6 100644 (file)
@@ -54,7 +54,7 @@ strspn(const char *str, const char *chars)
         if(*str == '\0')
                 return 0;
         if(*chars == '\0')
-                return strlen(str);
+                return 0;
 
         memset(charset, false, sizeof(charset));
         for( ; *chars != '\0'; chars++)