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>
This commit is contained in:
parent
b9bbe1bccb
commit
08fdddea3d
@ -175,6 +175,8 @@ split_lines(char *p, const char *plim) {
|
|||||||
|
|
||||||
for (i = 0; p < plim; i++) {
|
for (i = 0; p < plim; i++) {
|
||||||
p = strchr(p, '\n');
|
p = strchr(p, '\n');
|
||||||
|
if (!p)
|
||||||
|
break;
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user