diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index 948f9df..13742da 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
struct aparam_header *hdr = (struct aparam_header *) aparam;
uint16_t phonebooksize;
+ if (vcards < 0)
+ vcards = 0;
+
DBG("vcards %d", vcards);
phonebooksize = htons(vcards);
DBG("");
+ if (vcards < 0) {
+ obex_object_set_io_flags(pbap, G_IO_ERR, -ENOENT);
+ return;
+ }
+
if (!pbap->buffer)
pbap->buffer = g_string_new_len(buffer, bufsize);
else
pbap->buffer = g_string_new_len(aparam, sizeof(aparam));
goto done;
}
+
+ if (pbap->cache.entries == NULL) {
+ pbap->cache.valid = TRUE;
+ obex_object_set_io_flags(pbap, G_IO_ERR, -ENOENT);
+ return;
+ }
+
/*
* Don't free the sorted list content: this list contains
* only the reference for the "real" cache entry.
diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index 39e4c81..2da825b 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
gboolean cdata_present = FALSE;
char *home_addr, *work_addr;
+ if (num_fields < 0) {
+ data->cb(NULL, 0, num_fields, 0, data->user_data);
+ goto fail;
+ }
+
DBG("reply %p", reply);
if (reply == NULL)
g_slist_length(data->contacts), 0,
data->user_data);
- g_slist_free(data->contacts);
g_string_free(vcards, TRUE);
+fail:
+ g_slist_free(data->contacts);
g_free(data);
}
char *formatted;
int i;
- if (reply == NULL)
+ if (reply == NULL || num_fields < 0)
goto done;
/* the first element is the URI, always not empty */
return;
done:
- if (num_fields == 0)
+ if (num_fields <= 0)
cache->ready_cb(cache->user_data);
g_free(cache);