* vasprintf.c (int_vasprintf): Hack to handle NULL passed for %s.
authorWerner Koch <wk@gnupg.org>
Tue, 20 Aug 2002 11:59:38 +0000 (11:59 +0000)
committerWerner Koch <wk@gnupg.org>
Tue, 20 Aug 2002 11:59:38 +0000 (11:59 +0000)
trunk/gpgme/ChangeLog
trunk/gpgme/vasprintf.c

index 0a31b5c2a016455e613ac5ce581f40ad887b223f..2e6f1165070d360f1c38d5f50cfab2f831fc1bb9 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-20  Werner Koch  <wk@gnupg.org>
+
+       * vasprintf.c (int_vasprintf): Hack to handle NULL passed for %s.
+
 2002-08-20  Marcus Brinkmann  <marcus@g10code.de>
 
        * gpgme.c (_gpgme_set_op_info): Append data on subsequent calls.
index 9e39966a44b75afff89f3c45e6a8fc19416789ec..30b5e83f14d26c02ef88d0aa18aae2b5f3c7b6dc 100644 (file)
@@ -97,7 +97,13 @@ int_vasprintf (result, format, args)
              total_width += 307;
              break;
            case 's':
-             total_width += strlen (va_arg (ap, char *));
+              {
+                char *tmp = va_arg (ap, char *);
+                if (tmp)
+                  total_width += strlen (tmp);
+                else /* in case the vsprintf does prints a text */
+                  total_width += 25; /* e.g. "(null pointer reference)" */
+              }
              break;
            case 'p':
            case 'n':