[PATCH obexd 2/2] Add NULL-field checking in vcard_printf_address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Without that checking strlen(..) could be called with NULL
as param and this will result crash (in some scenarios
'field' may be NULL)
---
 plugins/vcard.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugins/vcard.c b/plugins/vcard.c
index c0a33cb..dc20a77 100644
--- a/plugins/vcard.c
+++ b/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 */
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux