laforge has submitted this change. (
https://gerrit.osmocom.org/c/osmo-pcap/+/42841?usp=email )
Change subject: server: do not abort process on short conn message
......................................................................
server: do not abort process on short conn message
conn_read_cb() used OSMO_ASSERT() to check that the received
message holds at least a full osmo_pcap_data header. Although
conn_segmentation_cb2() should only ever hand up complete frames,
asserting on a length derived from network input means a framing
anomaly would abort the entire server (taking down all other clients'
captures). Close the offending connection gracefully instead,
consistent with the other error paths in this function.
Change-Id: Ia102ff918ef8152d212e10a860f5dc70efec880b
AI-Assisted: yes (Claude)
---
M src/osmo_server_network.c
1 file changed, 8 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c
index da14480..6c0e609 100644
--- a/src/osmo_server_network.c
+++ b/src/osmo_server_network.c
@@ -449,7 +449,14 @@
return 0;
}
- OSMO_ASSERT(msgb_length(msg) >= sizeof(*data));
+ if (OSMO_UNLIKELY(msgb_length(msg) < sizeof(*data))) {
+ /* Should not happen: conn_segmentation_cb2() only hands us
complete
+ * frames. Close the conn gracefully instead of aborting the
server. */
+ LOGP(DSERVER, LOGL_ERROR, "Read short message from conn: %u <
%zu\n",
+ msgb_length(msg), sizeof(*data));
+ osmo_pcap_conn_close(conn);
+ return 0;
+ }
msg->l1h = msgb_data(msg);
data = (struct osmo_pcap_data *)msg->l1h;
--
To view, visit https://gerrit.osmocom.org/c/osmo-pcap/+/42841?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-Change-Id: Ia102ff918ef8152d212e10a860f5dc70efec880b
Gerrit-Change-Number: 42841
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-CC: pespin <[email protected]>