bluez/lib
Bastien Nocera bd954700e6 sdp: Fix ineffective error guard
The return value from gen_attridseq_pdu() can be -ENOMEM or the always
positive return value from sdp_gen_pdu(), but we only guard against a
single negative return value "-1" (-EPERM).

Check for all negative values to avoid manipulating a negative length as
a valid one.

Error: INTEGER_OVERFLOW (CWE-190): [#def10] [important]
lib/sdp.c:4097:2: overflow_sink:
"t->reqsize + cstate_len", which might have underflowed, is passed to
"sdp_send_req(session, t->reqbuf, t->reqsize + cstate_len)".
4095|		reqhdr->plen = htons((t->reqsize + cstate_len) - sizeof(sdp_pdu_hdr_t));
4096|
4097|->		if (sdp_send_req(session, t->reqbuf, t->reqsize + cstate_len) < 0) {
4098|			SDPERR("Error sending data:%m");
4099|			t->err = errno;

Error: INTEGER_OVERFLOW (CWE-190): [#def11] [important]
lib/sdp.c:4492:3: overflow_sink:
"reqsize", which might have underflowed, is passed to
"sdp_send_req_w4_rsp(session, reqbuf, rspbuf, reqsize, &rspsize)".
4490|			reqhdr->plen = htons(reqsize - sizeof(sdp_pdu_hdr_t));
4491|			rsphdr = (sdp_pdu_hdr_t *) rspbuf;
4492|->			status = sdp_send_req_w4_rsp(session, reqbuf, rspbuf, reqsize, &rspsize);
4493|			if (rspsize < sizeof(sdp_pdu_hdr_t)) {
4494|				SDPERR("Unexpected end of packet");
2024-06-03 15:06:36 -04:00
..
a2mp.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
amp.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
bluetooth.c lib: Replace malloc/memset(..0..) with bt_malloc0 2020-10-07 15:56:21 -07:00
bluetooth.h lib: add BT_POLL_ERRQUEUE socket option 2024-04-10 12:31:46 -04:00
bluez.pc.in build: Move bluez.pc into the library directory 2012-12-19 18:27:14 +01:00
bnep.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
cmtp.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
hci_lib.h lib: const annotate hci_map instances and related API 2024-01-19 15:45:07 -05:00
hci.c lib: const annotate hci_map instances and related API 2024-01-19 15:45:07 -05:00
hci.h lib: Fix HCI_MAX_ACL_SIZE 2021-09-22 14:32:38 -07:00
hidp.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
iso.h lib: Add definitions for ISO socket 2022-07-22 13:31:42 -07:00
l2cap.h l2test: Fix setting mode for BR/EDR l2cap socket 2023-03-28 13:49:35 -07:00
mgmt.h monitor: Add decoding support for Sync Receiver events 2023-07-05 10:48:31 -07:00
rfcomm.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
sco.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
sdp_lib.h lib/sdp: Pass size_t to sdp_get_string_attr() 2023-11-13 13:57:03 -05:00
sdp.c sdp: Fix ineffective error guard 2024-06-03 15:06:36 -04:00
sdp.h lib: Add SPDX License Identifier 2020-09-21 16:19:34 -07:00
uuid.c lib/uuid: Add support to compare 16bit uuids 2024-02-13 15:41:06 -05:00
uuid.h lib/uuid: Add support to compare 16bit uuids 2024-02-13 15:41:06 -05:00