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
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("");
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);
}