From bdcd1fe42febb04e1be428bdfa022f89b65a1cb1 Mon Sep 17 00:00:00 2001 From: Raquel Medina Date: Wed, 21 Oct 2020 13:20:34 +0200 Subject: fix history segfault following transport disconnect The segmentation fault manifests if the remote disconnects pbap transport followed by a refresh pbap data operation. The root cause is a read operation of vcard data for the calls history, ignoring the error triggered while attempting to access the corresponding file on the remote device. The current patch introduces the missing check for errors. SPEC-3652 Signed-off-by: Raquel Medina Change-Id: I916ba5b8b5fc29aa9b928dbf2ed3e7c892d15891 test & deleteme Signed-off-by: Raquel Medina Change-Id: I9efa151af54ae87cbf7e67bb6b985a76e0814549 --- binding/bluetooth-pbap-binding.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'binding') diff --git a/binding/bluetooth-pbap-binding.c b/binding/bluetooth-pbap-binding.c index 1ff6e82..ccfbb7c 100644 --- a/binding/bluetooth-pbap-binding.c +++ b/binding/bluetooth-pbap-binding.c @@ -473,8 +473,15 @@ void history(afb_req_t request) if (!parse_max_entries_parameter(request, &max_entries)) return; - org_bluez_obex_phonebook_access1_call_select_sync( - phonebook, INTERNAL, list, NULL, NULL); + if (!phonebook) + return; + + if (!org_bluez_obex_phonebook_access1_call_select_sync( + phonebook, INTERNAL, COMBINED, NULL, NULL)) { + afb_req_fail(request, "cannot import call history", NULL); + return; + } + jresp = get_vcards(max_entries); afb_req_success(request, jresp, "call history"); -- cgit 1.2.3-korg