summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAravind Machiry <machiry@cs.ucsb.edu>2020-09-27 23:44:46 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-10-07 15:56:21 -0700
commit73bce2208627042bbc698715d00e99f0501f3258 (patch)
treee688237f37db67813d3ea16d3ea18c587b812e3b /lib
parentc96d5ec7aafc8fd988f6f19b896115853b951d91 (diff)
downloadbluez-73bce2208627042bbc698715d00e99f0501f3258.tar.gz
lib/sdp.c: Validate attribute search return value
The calls to gen_[searchseq|attridseq]_seq functions return negative value on failure. The return value should be checked to gracefully exit with a proper exit code.
Diffstat (limited to 'lib')
-rw-r--r--lib/sdp.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/sdp.c b/lib/sdp.c
index 532039a23..a27cd3a7b 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -3419,6 +3419,12 @@ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search,
/* add service class IDs for search */
seqlen = gen_searchseq_pdu(pdata, search);
+ if (seqlen < 0) {
+ errno = EINVAL;
+ status = -1;
+ goto end;
+ }
+
SDPDBG("Data seq added : %d", seqlen);
/* set the length and increment the pointer */
@@ -3841,6 +3847,11 @@ int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, u
/* add service class IDs for search */
seqlen = gen_searchseq_pdu(pdata, search);
+ if (seqlen < 0) {
+ t->err = EINVAL;
+ goto end;
+ }
+
SDPDBG("Data seq added : %d", seqlen);
/* now set the length and increment the pointer */
@@ -4054,6 +4065,11 @@ int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *sear
/* add service class IDs for search */
seqlen = gen_searchseq_pdu(pdata, search);
+ if (seqlen < 0) {
+ t->err = EINVAL;
+ goto end;
+ }
+
SDPDBG("Data seq added : %d", seqlen);
/* now set the length and increment the pointer */