[PATCH] fixing crash in irmc.c when vcard=0

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

 



When using sync profile, if getting the number of vcard is 0 in server,obexd will crash.
The reason is that the null point is used in query_result of irmc.c.The patch is for fixing it.
Signed-off-by: wu.zheng@xxxxxxxxx  
---
 plugins/irmc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/plugins/irmc.c b/plugins/irmc.c
index 0fb92be..2ecae21 100644
--- a/plugins/irmc.c
+++ b/plugins/irmc.c
@@ -167,6 +167,8 @@ static void query_result(const char *buffer, size_t bufsize, int vcards,
 	else
 		irmc->buffer = g_string_append(irmc->buffer, owner_vcard);
 
+	if (buffer == NULL)
+		goto finish;
 	/* loop around buffer and add X-IRMC-LUID attribs */
 	s = buffer;
 	while ((t = strstr(s, "UID:")) != NULL) {
@@ -189,7 +191,7 @@ static void query_result(const char *buffer, size_t bufsize, int vcards,
 	}
 	/* add remaining bit of buffer */
 	irmc->buffer = g_string_append(irmc->buffer, s);
-
+finish:
 	obex_object_set_io_flags(irmc, G_IO_IN, 0);
 }
 
-- 
1.7.3.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