[lxc-devel] [PATCH] Ensure argv passed by createl to create is NULL terminated

Serge Hallyn serge.hallyn at canonical.com
Mon Nov 26 18:10:18 UTC 2012


Quoting Dwight Engen (dwight.engen at oracle.com):
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/lxccontainer.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index 37f5ed7..4818b2c 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -683,13 +683,14 @@ static bool lxcapi_createl(struct lxc_container *c, char *t, ...)
>  		if (!arg)
>  			break;
>  		nargs++;
> -		temp = realloc(args, nargs * sizeof(*args));
> +		temp = realloc(args, (nargs+1) * sizeof(*args));
>  		if (!temp)
>  			goto out;
>  		args = temp;
>  		args[nargs - 1] = arg;
>  	}
>  	va_end(ap);
> +	args[nargs] = NULL;
>  
>  	bret = c->create(c, t, args);
>  
> -- 
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list