[Libguestfs] [PATCH] btrfs: Fix improper memmove usage in do_btrfs_subvolume_list

Richard W.M. Jones rjones at redhat.com
Sat Oct 12 06:34:12 UTC 2013


On Fri, Oct 11, 2013 at 10:26:07PM -0400, John Eckersberg wrote:
> The third parameter (number of bytes to copy) was given as an offset
> relative to dest, when it should be relative to src.  This fixes some
> valgrind warnings I happened across.
> ---
>  daemon/btrfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/daemon/btrfs.c b/daemon/btrfs.c
> index c3247ac..765dec6 100644
> --- a/daemon/btrfs.c
> +++ b/daemon/btrfs.c
> @@ -473,7 +473,7 @@ do_btrfs_subvolume_list (const mountable_t *fs)
>  
>      #undef XSTRTOU64
>  
> -    memmove (line, line + ovector[6], ovector[7] + 1);
> +    memmove (line, line + ovector[6], ovector[7] - ovector[6] + 1);
>      this->btrfssubvolume_path = line;
>    }

Thanks - I've applied this and pushed it.

I believe this fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1018149

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list