]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage: avoid segfault 1803/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 11 Sep 2017 01:30:00 +0000 (03:30 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 11 Sep 2017 06:45:54 +0000 (08:45 +0200)
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 <christian.brauner@ubuntu.com>
src/lxc/storage/storage.c

index 30aaaaa938df6885f699a019e15ab2b0c74391bd..da624b8186fdab5af52536c5a9e36c7c5f26a5a3 100644 (file)
@@ -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.
         */