Diff between 698e3edc24ad0a94122b43a339cf9fe7e988fbcb and 5d7835ea904b08a3f3f1dccaeae70f38622e9744

Changed Files

File Additions Deletions Status
obexd/plugins/pbap.c +12 -2 modified

Full Patch

diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index 2d3bebd..7422a1e 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
@@ -555,7 +555,7 @@ static int pbap_get(struct obex_session *os, obex_object_t *obj,
 
 	DBG("name %s type %s pbap %p", name, type, pbap);
 
-	if (type == NULL)
+	if (type == NULL || name == NULL)
 		return -EBADR;
 
 	rsize = obex_aparam_read(os, obj, &buffer);
@@ -689,6 +689,11 @@ static void *vobject_pull_open(const char *name, int oflag, mode_t mode,
 		goto fail;
 	}
 
+	if (name == NULL) {
+		ret = -EBADR;
+		goto fail;
+	}
+
 	if (pbap->params->maxlistcount == 0)
 		cb = phonebook_size_result;
 	else
@@ -720,6 +725,11 @@ static void *vobject_list_open(const char *name, int oflag, mode_t mode,
 		goto fail;
 	}
 
+	if (name == NULL) {
+		ret = -EBADR;
+		goto fail;
+	}
+
 	/* PullvCardListing always get the contacts from the cache */
 
 	if (pbap->cache.valid) {
@@ -758,7 +768,7 @@ static void *vobject_vcard_open(const char *name, int oflag, mode_t mode,
 		goto fail;
 	}
 
-	if (sscanf(name, "%u.vcf", &handle) != 1) {
+	if (name == NULL || sscanf(name, "%u.vcf", &handle) != 1) {
 		ret = -EBADR;
 		goto fail;
 	}