]> sourceware.org Git - newlib-cygwin.git/commitdiff
Fix coverity CID 143502: Null pointer dereference
authorCorinna Vinschen <corinna@vinschen.de>
Thu, 24 Mar 2016 09:06:50 +0000 (10:06 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 24 Mar 2016 09:06:50 +0000 (10:06 +0100)
* libc/locale/ldpart.c (split_lines): Don't dereference result
of strchr without checking for NULL pointer first.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
newlib/libc/locale/ldpart.c

index 35ad3bd13ab61e57c6920ee36de1347f9c953a22..27900c2897473f52520aaca8610d204223e29514 100644 (file)
@@ -175,6 +175,8 @@ split_lines(char *p, const char *plim) {
 
        for (i = 0; p < plim; i++) {
                p = strchr(p, '\n');
+               if (!p)
+                       break;
                *p++ = '\0';
        }
        return i;
This page took 0.03078 seconds and 5 git commands to generate.