[Pkg-gnupg-commit] [libassuan] 342/437: 2010-11-17 Marcus Brinkmann <mb at g10code.com>

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:34:01 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit e940277acdb475ccc2bba05828b46ffea7c4729b
Author: Marcus Brinkmann <mb at g10code.com>
Date:   Wed Nov 17 16:49:53 2010 +0000

    2010-11-17  Marcus Brinkmann  <mb at g10code.com>
    
            * vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM && _MSC_VER]:
            Just use a fixed size buffer, as va_copy is not easy to fake.
---
 src/ChangeLog   |  3 +++
 src/vasprintf.c | 14 ++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index 1aedde3..676f3aa 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
 2010-11-17  Marcus Brinkmann  <mb at g10code.com>
 
+	* vasprintf.c (int_vasprintf) [HAVE_W32CE_SYSTEM && _MSC_VER]:
+	Just use a fixed size buffer, as va_copy is not easy to fake.
+
 	* gpgcedev.c (struct pipeimpl_s): Add member monitor_rvid.
 	(struct monitor_s, monitor_t): New types.
 	(monitor_table, monitor_table_size): New static variables.
diff --git a/src/vasprintf.c b/src/vasprintf.c
index b46cdf7..e55408a 100644
--- a/src/vasprintf.c
+++ b/src/vasprintf.c
@@ -51,6 +51,19 @@ int_vasprintf (result, format, args)
      const char *format;
      va_list *args;
 {
+#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
+  /* No va_copy and the replacement above doesn't work.  */
+#define MAX_STRLEN 256
+  *result = malloc (MAX_STRLEN);
+  if (*result != NULL)
+    {
+      int res = _vsnprintf (*result, MAX_STRLEN, format, *args);
+      (*result)[MAX_STRLEN - 1] = '\0';
+      return res;
+    }
+  else
+    return 0;
+#else
   const char *p = format;
   /* Add one to make sure that it is never zero, which might cause malloc
      to return NULL.  */
@@ -133,6 +146,7 @@ int_vasprintf (result, format, args)
     return vsprintf (*result, format, *args);
   else
     return 0;
+#endif
 }
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list