fixeria has uploaded this change for review.

View Change

sdp_msg: fix stack buffer overflow in sdp_parse_connection_info()

sdp_parse_connection_info() parses the SDP 'c=' line using sscanf()
with two unbounded %s conversions into char ipv[10] and char
addr_str[INET6_ADDRSTRLEN]. An over-long token in the 'c=' line,
e.g. received in the 'sdp' field of an MNCC_SETUP_REQ via the external
MNCC interface, overflows these buffers on the stack, overwriting the
return address and crashing osmo-msc.

Bound both conversions with field widths matching the buffer sizes.

Reported by Calif.io, in collaboration with Anthropic
(reference: ANT-2026-ZV45QDEP).

Change-Id: I4e0b8b75928f616f1bf1d71140298d9b7611da96
Fixes: OS#7103
---
M src/libmsc/sdp_msg.c
1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/95/44195/1
diff --git a/src/libmsc/sdp_msg.c b/src/libmsc/sdp_msg.c
index 9b4cd98..79531b9 100644
--- a/src/libmsc/sdp_msg.c
+++ b/src/libmsc/sdp_msg.c
@@ -461,7 +461,7 @@
{
char ipv[10];
char addr_str[INET6_ADDRSTRLEN];
- if (sscanf(src, "IN %s %s", ipv, addr_str) < 2)
+ if (sscanf(src, "IN %9s %45s", ipv, addr_str) < 2)
return -EINVAL;

/* supporting only IPv4 */

To view, visit change 44195. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I4e0b8b75928f616f1bf1d71140298d9b7611da96
Gerrit-Change-Number: 44195
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>