mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-14 03:21:21 +00:00
lxc.rootfs: support multiple lower layers
Do it in a safe way by using strstr() to check for the substring ":/" should ':' be part of a pathname. This should be a safer implementation than the one originally suggested in #547. Signed-off-by: Christian Brauner <christian.brauner@mailbox.org> Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
f267d6668e
commit
9208af160e
@ -309,7 +309,7 @@ char *ovl_getlower(char *p)
|
||||
|
||||
int ovl_mount(struct bdev *bdev)
|
||||
{
|
||||
char *options, *dup, *lower, *upper;
|
||||
char *tmp, *options, *dup, *lower, *upper;
|
||||
char *options_work, *work, *lastslash;
|
||||
int lastslashidx;
|
||||
int len, len2;
|
||||
@ -331,9 +331,15 @@ int ovl_mount(struct bdev *bdev)
|
||||
*/
|
||||
dup = alloca(strlen(bdev->src) + 1);
|
||||
strcpy(dup, bdev->src);
|
||||
if (!(lower = strchr(dup, ':')))
|
||||
return -22;
|
||||
if (!(upper = strchr(++lower, ':')))
|
||||
/* support multiple lower layers */
|
||||
if (!(lower = strstr(dup, ":/")))
|
||||
return -22;
|
||||
lower++;
|
||||
upper = lower;
|
||||
while ((tmp = strstr(++upper, ":/"))) {
|
||||
upper = tmp;
|
||||
}
|
||||
if (--upper == lower)
|
||||
return -22;
|
||||
*upper = '\0';
|
||||
upper++;
|
||||
|
Loading…
Reference in New Issue
Block a user