bug in newpg-0.9.4/common vasprintf implementation

Andrew J. Schorr aschorr at telemetry-investments.com
Tue Nov 11 10:43:19 CET 2003


Hi,

I just built newpg-0.9.4 on Solaris 8/x86 which does not have the
apsprintf() and vasprintf() functions in the C library.  As a result,
the build uses the implementation located in common/vasprintf.c.
However, there is a minor bug in that implementation (for some reason,
the 3rd argument to vasprintf was declared as a pointer to a va_list
instead of a va_list).  Anyway, I am attaching the trivial patch to get
things working on Solaris.  Gpg-agent no longer SEGV's after this patch
has been applied.

I hope this mailing list is the proper place to submit such patches.
I apologize in advance if it's not.

Cheers,
Andy
-------------- next part --------------
--- common/util.h.0	Fri Aug  9 09:47:51 2002
+++ common/util.h	Tue Nov 11 09:57:19 2003
@@ -71,7 +71,7 @@
 /*-- replacement functions from funcname.c --*/
 #if !HAVE_VASPRINTF
 #include <stdarg.h>
-int vasprintf (char **result, const char *format, va_list *args);
+int vasprintf (char **result, const char *format, va_list args);
 int asprintf (char **result, const char *format, ...);
 #endif
 
--- common/vasprintf.c.0	Mon Sep  9 06:10:40 2002
+++ common/vasprintf.c	Tue Nov 11 09:56:48 2003
@@ -31,7 +31,7 @@
 #endif
 
 int
-vasprintf (char **result, const char *format, va_list *args)
+vasprintf (char **result, const char *format, va_list args)
 {
   const char *p = format;
   /* Add one to make sure that it is never zero, which might cause malloc
@@ -120,7 +120,7 @@
 #endif
   *result = malloc (total_width);
   if (*result != NULL)
-    return vsprintf (*result, format, *args);
+    return vsprintf (*result, format, args);
   else
     return 0;
 }


More information about the Gnupg-devel mailing list