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

Eric Blake eblake at redhat.com
Tue May 4 22:12:09 UTC 2010


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.

 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);
-- 
1.6.6.1




More information about the libvir-list mailing list