Diff between abad371ed91add18aa34ffd354d3a6ef7793954f and e368ac5eeb4c7031e36eee8468e8e990a4f4dc6a

Changed Files

File Additions Deletions Status
obexd/plugins/phonebook-dummy.c +10 -9 modified

Full Patch

diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index 1f32ad8..6ad0266 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -257,12 +257,18 @@ static void entry_notify(const char *filename, VObject *v, void *user_data)
 	VObject *property, *subproperty;
 	GString *name;
 	const char *tel;
-	unsigned int handle;
+	long unsigned int handle;
 
 	property = isAPropertyOf(v, VCNameProp);
 	if (!property)
 		return;
 
+	if (sscanf(filename, "%lu.vcf", &handle) != 1)
+		return;
+
+	if (handle > UINT32_MAX)
+		return;
+
 	/* LastName; FirstName; MiddleName; Prefix; Suffix */
 
 	name = g_string_new("");
@@ -294,16 +300,11 @@ static void entry_notify(const char *filename, VObject *v, void *user_data)
 				fakeCString(vObjectUStringZValue(subproperty)));
 
 	property = isAPropertyOf(v, VCTelephoneProp);
-	if (!property)
-		goto done;
 
-	tel = fakeCString(vObjectUStringZValue(property));
-	if (sscanf(filename, "%u.vcf", &handle) == 1)
-		handle = handle > UINT32_MAX ? UINT32_MAX : handle;
-		query->entry_cb(filename, handle, name->str, NULL, tel,
-							query->user_data);
+	tel = property ? fakeCString(vObjectUStringZValue(property)) : NULL;
 
-done:
+	query->entry_cb(filename, handle, name->str, NULL, tel,
+							query->user_data);
 	g_string_free(name, TRUE);
 }