pespin has submitted this change. (
https://gerrit.osmocom.org/c/libosmo-abis/+/38808?usp=email )
Change subject: ipaccess: Clarify access to msgb ipa payload in code path
......................................................................
ipaccess: Clarify access to msgb ipa payload in code path
The pointer to the data payload is gathered at a later place after the
first byte of the pointer has actually already been read.
Clean it up so that it becomes obvious when and how the payload is
accessed.
Change-Id: I5eac24bdf72021e500c554bdc6d8449bf37d2231
---
M src/input/ipaccess.c
1 file changed, 4 insertions(+), 3 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
pespin: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index dc523ef..51e6087 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -871,7 +871,10 @@
/* special handling for IPA CCM. */
if (hh->proto == IPAC_PROTO_IPACCESS) {
- uint8_t msg_type = *(msg->l2h);
+ uint8_t *data = msgb_l2(msg);
+ int len = msgb_l2len(msg);
+ OSMO_ASSERT(len > 0);
+ uint8_t msg_type = *data;
/* peek the pong for our keepalive fsm */
if (line && msg_type == IPAC_MSGT_PONG) {
@@ -886,8 +889,6 @@
/* this is a request for identification from the BSC. */
if (msg_type == IPAC_MSGT_ID_GET) {
- uint8_t *data = msgb_l2(msg);
- int len = msgb_l2len(msg);
int trx_nr = 0;
if (link->ofd->priv_nr >= E1INP_SIGN_RSL)
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-abis/+/38808?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I5eac24bdf72021e500c554bdc6d8449bf37d2231
Gerrit-Change-Number: 38808
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>