Skip to contentSkip to conversation

Fix strrchr()

PATCH New Samuel Thibault 1 participant 1 message Nov 27, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix strrchr()

Fix strrchr() when string doesn't contain the character.

extras/mini-os/lib/string.c +1 -1
diff -r 26e766e0c628 extras/mini-os/lib/string.c
@@ -142,7 +142,7 @@ char * strchr(const char * s, int c)
 
 char * strrchr(const char * s, int c)
 {
-        const char *res;
+        const char *res = NULL;
         for(; *s != '\0'; ++s)
                 if (*s == (char) c)
                         res = s;