diff options
author | John Snow <jsnow@redhat.com> | 2015-02-26 22:09:04 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2015-03-02 13:35:21 +0000 |
commit | 37fe3688870a47bd46c25e3feba05430bafebd2e (patch) | |
tree | 28ab4d047d56b18ba04e404d84e88c1172b0edd5 | |
parent | c135e79a5dbc9bc148bfbb896a6172ec31519853 (diff) | |
download | cachefilesd-37fe3688870a47bd46c25e3feba05430bafebd2e.tar.gz |
Fixing null reference for malformed kernel status output.
In certain cases, a NULL may be passed along to string library functions.
Not anymore!
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r-- | cachefilesd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cachefilesd.c b/cachefilesd.c index 7059876..72525bc 100644 --- a/cachefilesd.c +++ b/cachefilesd.c @@ -759,8 +759,12 @@ static void read_cache_state(void) *next++ = '\0'; arg = strchr(tok, '='); - if (arg) + if (arg) { *arg++ = '\0'; + } else { + debug(0, "Warning: malformed output from kernel, missing arg to [%s]", tok); + continue; + } if (strcmp(tok, "cull") == 0) cull = strtoul(arg, NULL, 0); |