From f3cc176594b51d4ff3aa96c0246a75c0e87e4cbc Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 21 Apr 2017 20:24:58 +0300 Subject: [PATCH] obexd/pbap: Fix hanging when maxlistcount = 0 vobject_list_get_next_header shall only attempt to call g_obex_apparam_encode otherwise it will just keep adding the same tag in a loop. --- obexd/plugins/pbap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c index ad9320876..d5a3046ae 100644 --- a/obexd/plugins/pbap.c +++ b/obexd/plugins/pbap.c @@ -369,6 +369,7 @@ static int generate_response(void *user_data) /* Ignore all other parameter and return PhoneBookSize */ uint16_t size = g_slist_length(pbap->cache.entries); + pbap->obj->firstpacket = TRUE; pbap->obj->apparam = g_obex_apparam_set_uint16( pbap->obj->apparam, PHONEBOOKSIZE_TAG, @@ -892,8 +893,10 @@ static ssize_t vobject_list_get_next_header(void *object, void *buf, size_t mtu, *hi = G_OBEX_HDR_APPARAM; - if (pbap->params->maxlistcount == 0) + if (obj->firstpacket) { + obj->firstpacket = FALSE; return g_obex_apparam_encode(obj->apparam, buf, mtu); + } return 0; } -- 2.47.3