[lxc-devel] [PATCH] open_without_symlink: Account when prefix is empty string
Serge Hallyn
serge.hallyn at ubuntu.com
Fri Jan 8 19:18:51 UTC 2016
Quoting Bogdan Purcareata (bogdan.purcareata at nxp.com):
> In the current implementation, the open_without_symlink function
> will default to opening the root mount only if the passed rootfs
> prefix is null. It doesn't account for the case where this prefix
> is passed as an empty string.
>
> Properly handle this second case as well.
>
> Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>
I didn't think that would happen anywhere (and prefer not to
paper over potential bugs in general) but I assume you found
a case where it does, and I don't use containers without
rootfs so wouldn't see them. So
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
thanks.
> ---
> src/lxc/utils.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index ad9b0a2..8fa7e6b 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -1570,7 +1570,7 @@ static int open_without_symlink(const char *target, const char *prefix_skip)
> fulllen = strlen(target);
>
> /* make sure prefix-skip makes sense */
> - if (prefix_skip) {
> + if (prefix_skip && strlen(prefix_skip) > 0) {
> curlen = strlen(prefix_skip);
> if (!is_subdir(target, prefix_skip, curlen)) {
> ERROR("WHOA there - target '%s' didn't start with prefix '%s'",
> --
> 2.1.4
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
More information about the lxc-devel
mailing list