From: Christian Brauner Date: Mon, 11 Sep 2017 01:30:00 +0000 (+0200) Subject: storage: avoid segfault X-Git-Tag: lxc-3.0.0.beta1~245^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1803%2Fhead;p=thirdparty%2Flxc.git storage: avoid segfault When the "lxc.rootfs.path" property is not set and users request a container copy we would segfault since strstr() would be called on a NULL pointer. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c index 30aaaaa93..da624b818 100644 --- a/src/lxc/storage/storage.c +++ b/src/lxc/storage/storage.c @@ -337,6 +337,11 @@ struct lxc_storage *storage_copy(struct lxc_container *c, const char *cname, struct rsync_data data = {0}; char cmd_output[MAXPATHLEN] = {0}; + if (!src) { + ERROR("No rootfs specified"); + return NULL; + } + /* If the container name doesn't show up in the rootfs path, then we * don't know how to come up with a new name. */