From e180aa8a5b7a63af744c8704ba47caaaad6de05d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 12 Oct 2015 12:40:46 +0100 Subject: [PATCH] Fix NULL fixed strings printing. --- src/libutil/printf.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libutil/printf.c b/src/libutil/printf.c index 67a2f3d98..c8c6ace42 100644 --- a/src/libutil/printf.c +++ b/src/libutil/printf.c @@ -486,12 +486,20 @@ rspamd_vprintf_common (rspamd_printf_append_func func, if (v) { RSPAMD_PRINTF_APPEND (v->str, v->len); } + else { + RSPAMD_PRINTF_APPEND ("(NULL)", 6); + } continue; case 'T': tok = va_arg (args, rspamd_ftok_t *); - RSPAMD_PRINTF_APPEND (tok->begin, tok->len); + if (tok) { + RSPAMD_PRINTF_APPEND (tok->begin, tok->len); + } + else { + RSPAMD_PRINTF_APPEND ("(NULL)", 6); + } continue; case 'v': @@ -499,6 +507,9 @@ rspamd_vprintf_common (rspamd_printf_append_func func, if (gs) { RSPAMD_PRINTF_APPEND (gs->str, gs->len); } + else { + RSPAMD_PRINTF_APPEND ("(NULL)", 6); + } continue; -- 2.39.5