fixeria has uploaded this change for review.
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.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Change-Id: Ia102ff918ef8152d212e10a860f5dc70efec880b
---
M src/osmo_server_network.c
1 file changed, 8 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/41/42841/1
diff --git a/src/osmo_server_network.c b/src/osmo_server_network.c
index 3ab2003..5c0fc36 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 change 42841. To unsubscribe, or for help writing mail filters, visit settings.