fixeria has uploaded this change for review. ( 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. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> 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 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: newchange Gerrit-Project: osmo-pcap Gerrit-Branch: master Gerrit-Change-Id: Ia102ff918ef8152d212e10a860f5dc70efec880b Gerrit-Change-Number: 42841 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <[email protected]>
