From 45b4bb961820074ddee2cdebd3a5feec997e2906 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 11 Sep 2017 03:30:00 +0200 Subject: [PATCH] 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 --- src/lxc/storage/storage.c | 5 +++++ 1 file changed, 5 insertions(+) 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. */ -- 2.47.2