aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/printf.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-10 18:39:53 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-10 18:39:53 +0000
commit2a5b7be24240377c4b1c1eba701b9ca2fd17c2ab (patch)
tree5a3d5d97df0a8df06f3167cf5de7f8f8ac981b08 /src/libutil/printf.c
parent1fe8be4863c53245b5611c83dd311f473ba524d0 (diff)
downloadrspamd-2a5b7be24240377c4b1c1eba701b9ca2fd17c2ab.tar.gz
rspamd-2a5b7be24240377c4b1c1eba701b9ca2fd17c2ab.zip
Fix NULL strings, eh
Diffstat (limited to 'src/libutil/printf.c')
-rw-r--r--src/libutil/printf.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/libutil/printf.c b/src/libutil/printf.c
index a6099f83f..11c464be8 100644
--- a/src/libutil/printf.c
+++ b/src/libutil/printf.c
@@ -482,13 +482,14 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
case 'V':
v = va_arg (args, rspamd_fstring_t *);
- slen = v->len;
-
- if (G_UNLIKELY (width != 0)) {
- slen = MIN (v->len, width);
- }
if (v) {
+ slen = v->len;
+
+ if (G_UNLIKELY (width != 0)) {
+ slen = MIN (v->len, width);
+ }
+
RSPAMD_PRINTF_APPEND (v->str, slen);
}
else {
@@ -499,13 +500,13 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
case 'T':
tok = va_arg (args, rspamd_ftok_t *);
- slen = tok->len;
-
- if (G_UNLIKELY (width != 0)) {
- slen = MIN (tok->len, width);
- }
if (tok) {
+ slen = tok->len;
+
+ if (G_UNLIKELY (width != 0)) {
+ slen = MIN (tok->len, width);
+ }
RSPAMD_PRINTF_APPEND (tok->begin, slen);
}
else {
@@ -515,12 +516,14 @@ rspamd_vprintf_common (rspamd_printf_append_func func,
case 'v':
gs = va_arg (args, GString *);
- slen = gs->len;
- if (G_UNLIKELY (width != 0)) {
- slen = MIN (gs->len, width);
- }
if (gs) {
+ slen = gs->len;
+
+ if (G_UNLIKELY (width != 0)) {
+ slen = MIN (gs->len, width);
+ }
+
RSPAMD_PRINTF_APPEND (gs->str, slen);
}
else {