From 03f4a2e6ff11e3272dd88d9886f743bbabdc167f Mon Sep 17 00:00:00 2001 From: Radoslaw Jablonski Date: Mon, 10 Oct 2011 09:22:39 +0200 Subject: [PATCH] obexd: Add NULL-field checking in vcard_printf_address Without that checking strlen(..) could be called with NULL as param and this will result crash (in some scenarios 'field' may be NULL) --- obexd/plugins/vcard.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/obexd/plugins/vcard.c b/obexd/plugins/vcard.c index c0a33cb50..dc20a7721 100644 --- a/obexd/plugins/vcard.c +++ b/obexd/plugins/vcard.c @@ -680,8 +680,11 @@ static void vcard_printf_address(GString *vcards, uint8_t format, for (l = address->fields; l; l = l->next) { char *field = l->data; - set_escape(format, field_esc, field, LEN_MAX, strlen(field)); - g_strlcat(fields, field_esc, len); + if (field) { + set_escape(format, field_esc, field, LEN_MAX, + strlen(field)); + g_strlcat(fields, field_esc, len); + } if (l->next) /* not adding ';' after last addr field */ -- 2.47.3