summaryrefslogtreecommitdiff
path: root/plugins/irmc.c
diff options
context:
space:
mode:
authorZheng Wu <wu.zheng@intel.com>2011-07-27 11:05:47 +0800
committerJohan Hedberg <johan.hedberg@intel.com>2011-07-27 10:54:47 +0300
commit3625dca7cf0f2e896e1f14e2d94528ba39008747 (patch)
tree8d07835cf790ff7af2479d673513eb49fcc3e2f8 /plugins/irmc.c
parent7c256466374beeb541d3df9bf320c07bc9e791e5 (diff)
downloadobexd-3625dca7cf0f2e896e1f14e2d94528ba39008747.tar.gz
Fix crash in irmc.c for vCard 0
If getting the number of vCard is 0 in sync server, obexd will crash. The reason is that null point is used in query_result of irmc.c.
Diffstat (limited to 'plugins/irmc.c')
-rw-r--r--plugins/irmc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/irmc.c b/plugins/irmc.c
index 0fb92be..57a66b7 100644
--- a/plugins/irmc.c
+++ b/plugins/irmc.c
@@ -167,6 +167,9 @@ 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 done;
+
/* loop around buffer and add X-IRMC-LUID attribs */
s = buffer;
while ((t = strstr(s, "UID:")) != NULL) {
@@ -190,6 +193,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);
+done:
obex_object_set_io_flags(irmc, G_IO_IN, 0);
}