[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] util: fix va_start usage bug



Eric Blake wrote:
> Detected by clang.  POSIX requires that the second argument to
> va_start be the name of the last variable; and in some implementations,
> passing *path instead of path would dereference bogus memory instead
> of pulling arguments off the stack.
>
> * src/util/util.c (virBuildPathInternal): Use correct argument to
> va_start.
> ---
>
> I think this falls under the trivial rule, as it silences a
> compiler warning and is a one-line fix of a real bug, so I pushed it.

In a way it's trivial, but it's also rather subtle.
ACK, regardless.

>  src/util/util.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/util/util.c b/src/util/util.c
> index 2d32952..c44d012 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -2799,7 +2799,7 @@ int virBuildPathInternal(char **path, ...)
>      va_list ap;
>      int ret = 0;
>
> -    va_start(ap, *path);
> +    va_start(ap, path);
>
>      path_component = va_arg(ap, char *);
>      virBufferAdd(&buf, path_component, -1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]