laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/32072 )
Change subject: fix pcu_rx(): actually discard malformed container message ......................................................................
fix pcu_rx(): actually discard malformed container message
Currently we do log an error, but then still call pcu_rx_container(), passing it a malformed message. The function does have an additional length check inside, but let's better discard it early.
Change-Id: I8410ecf35442ab75741a5c9cd29d640ce5508e57 Related: OS#5963 --- M src/pcu_l1_if.cpp 1 file changed, 16 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp index bbeb3aa..577ba57 100644 --- a/src/pcu_l1_if.cpp +++ b/src/pcu_l1_if.cpp @@ -1285,6 +1285,8 @@ if (pcu_prim_length < exp_len) { LOGP(DL1IF, LOGL_ERROR, "Received %zu bytes on PCU Socket, but primitive container size" \ "is %zu, discarding\n", pcu_prim_length, exp_len); + rc = -EINVAL; + break; } rc = pcu_rx_container(bts, &pcu_prim->u.container); break;