]> source.dussan.org Git - rspamd.git/commitdiff
Fix NULL fixed strings printing.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Oct 2015 11:40:46 +0000 (12:40 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Oct 2015 11:40:46 +0000 (12:40 +0100)
src/libutil/printf.c

index 67a2f3d98a1e6cbb215f60dfe3cdd422d6a635ac..c8c6ace42c533f063a0f43fe7c8d3cefb81cf534 100644 (file)
@@ -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;