All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Chang <ochang@google.com>
To: linux-bluetooth@vger.kernel.org
Cc: oss-fuzz-bugs@google.com, Oliver Chang <ochang@google.com>
Subject: [PATCH BlueZ 1/1] Fix buffer overflow in sdp_xml_parse_uuid128
Date: Sun, 10 Aug 2025 07:30:09 +0000	[thread overview]
Message-ID: <20250810073008.1824799-3-ochang@google.com> (raw)
In-Reply-To: <20250810073008.1824799-2-ochang@google.com>

This was found by OSS-Fuzz.

This can be reproduced by running this input:
`<uuid value="111111111111111111111111111111111111">`
against the harness in
https://github.com/google/oss-fuzz/blob/master/projects/bluez/fuzz_xml.c
which just calls `sdp_xml_parse_record`.

`sdp_xml_parse_uuid` checks that the length of the string is 36 (32
digits + 4 '-' characters) prior to calling `sdp_xml_parse_uuid128`.

There's no check preventing this data from being 36 digits (with no
"-"), which leads to a buffer overflow in sdp_xml_parse_uuid128.

https://issues.oss-fuzz.com/issues/42534847
https://oss-fuzz.com/testcase-detail/5070205940531200
---
 src/sdp-xml.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/sdp-xml.c b/src/sdp-xml.c
index 5efa62ab8..2fa8f28a0 100644
--- a/src/sdp-xml.c
+++ b/src/sdp-xml.c
@@ -125,10 +125,16 @@ static sdp_data_t *sdp_xml_parse_uuid128(const char *data)
 		buf[0] = data[i];
 		buf[1] = data[i + 1];
 
+		if (j >= sizeof(val.data))
+			return NULL;
+
 		val.data[j++] = strtoul(buf, 0, 16);
 		i += 2;
 	}
 
+	if (j != sizeof(val.data))
+		return NULL;
+
 	return sdp_data_alloc(SDP_UUID128, &val);
 }
 
-- 
2.50.1.703.g449372360f-goog


  reply	other threads:[~2025-08-10  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-10  7:30 [PATCH BlueZ 0/1] Fix buffer overflow in sdp_xml_parse_uuid128 Oliver Chang
2025-08-10  7:30 ` Oliver Chang [this message]
2025-08-10  8:51   ` bluez.test.bot
2025-08-11 20:40 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250810073008.1824799-3-ochang@google.com \
    --to=ochang@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=oss-fuzz-bugs@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.