master - cleanup: add extra test for argc==0
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1e3411aa3724ee9ee32f5cb4378526b9c355854d Commit: 1e3411aa3724ee9ee32f5cb4378526b9c355854d Parent: 458918b31953943a3cc44976388f008ca850c124 Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Jun 30 10:27:10 2016 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Fri Jul 1 00:44:48 2016 +0200
cleanup: add extra test for argc==0
Cleaup some compiler warning about posibility to allocate 0 size.
--- daemons/cmirrord/functions.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
daemons/cmirrord/functions.c +6 -0
@@ -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 ;