diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-03-24 12:06:50 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-03-24 12:06:50 +0300 |
commit | 08fdddea3d2a170f5476ad296d9b73bcf2948471 (patch) | |
tree | cb5f48ba09adf27a8e500b4728b8be9298e45271 /newlib | |
parent | b9bbe1bccb1254ce891fc92961be2ec3cd3f6e4a (diff) |
Fix coverity CID 143502: Null pointer dereference
* 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>
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/libc/locale/ldpart.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/newlib/libc/locale/ldpart.c b/newlib/libc/locale/ldpart.c index 35ad3bd13..27900c289 100644 --- a/newlib/libc/locale/ldpart.c +++ b/newlib/libc/locale/ldpart.c @@ -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; |