[lxc-devel] [PATCH 1/1] cgmanager: cgm_get: len = 0 is a query for length only

Stéphane Graber stgraber at ubuntu.com
Mon Apr 7 21:12:00 UTC 2014


On Mon, Apr 07, 2014 at 12:52:43PM -0500, Serge Hallyn wrote:
> The caller might (like lxc-test-startone does) pass in a valid
> (or invalid) buffer and 0 length.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/cgmanager.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lxc/cgmanager.c b/src/lxc/cgmanager.c
> index 8a5039a..1dea824 100644
> --- a/src/lxc/cgmanager.c
> +++ b/src/lxc/cgmanager.c
> @@ -689,7 +689,7 @@ static int cgm_get(const char *filename, char *value, size_t len, const char *na
>  	cgm_dbus_disconnect();
>  	free(cgroup);
>  	newlen = strlen(result);
> -	if (!value) {
> +	if (!len || !value) {
>  		// user queries the size
>  		nih_free(result);
>  		return newlen+1;
> -- 
> 1.9.1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140407/193e0d2e/attachment.sig>


More information about the lxc-devel mailing list