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>
const char *oldpath = c0->config_path;
struct rsync_data data;
- /* 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
+ /* 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.
*/
+ if (!src) {
+ ERROR("No rootfs specified");
+ return NULL;
+ }
+
if (strstr(src, oldname) == NULL) {
ERROR(
"original rootfs path %s doesn't include container name %s",