diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-06-30 10:27:10 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-07-01 00:44:48 +0200 |
commit | 1e3411aa3724ee9ee32f5cb4378526b9c355854d (patch) | |
tree | 95e4623098265720a936ffa0aee4df3f7c229000 /daemons/cmirrord | |
parent | 458918b31953943a3cc44976388f008ca850c124 (diff) | |
download | lvm2-1e3411aa3724ee9ee32f5cb4378526b9c355854d.tar.gz |
cleanup: add extra test for argc==0
Cleaup some compiler warning about posibility to allocate 0 size.
Diffstat (limited to 'daemons/cmirrord')
-rw-r--r-- | daemons/cmirrord/functions.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c index e9d3c0947..757d8e84f 100644 --- a/daemons/cmirrord/functions.c +++ b/daemons/cmirrord/functions.c @@ -573,6 +573,12 @@ static int clog_ctr(struct dm_ulog_request *rq) for (argc = 0, p = rq->data; (p = strstr(p, " ")); p++, argc++) *p = '\0'; + if (!argc) { + LOG_ERROR("Received constructor request with bad data %s", + rq->data); + return -EINVAL; + } + argv = malloc(argc * sizeof(char *)); if (!argv) return -ENOMEM; |