From dca8bd8c5927fa48351f1491f89288b25de984e8 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 20 Aug 2002 11:59:38 +0000 Subject: [PATCH] * vasprintf.c (int_vasprintf): Hack to handle NULL passed for %s. --- trunk/gpgme/ChangeLog | 4 ++++ trunk/gpgme/vasprintf.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 0a31b5c..2e6f116 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,7 @@ +2002-08-20 Werner Koch + + * vasprintf.c (int_vasprintf): Hack to handle NULL passed for %s. + 2002-08-20 Marcus Brinkmann * gpgme.c (_gpgme_set_op_info): Append data on subsequent calls. diff --git a/trunk/gpgme/vasprintf.c b/trunk/gpgme/vasprintf.c index 9e39966..30b5e83 100644 --- a/trunk/gpgme/vasprintf.c +++ b/trunk/gpgme/vasprintf.c @@ -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': -- 2.26.2