Attention is currently required from: laforge, pespin.
fixeria has posted comments on this change. (
https://gerrit.osmocom.org/c/libosmo-gprs/+/32644 )
Change subject: sm: Fix APN IE content not transmitted in Act PDP Ctx Req
......................................................................
Patch Set 1:
(1 comment)
File src/sm/sm_pdu.c:
https://gerrit.osmocom.org/c/libosmo-gprs/+/32644/comment/d65c78bd_87fdc48f
PS1, Line 208: rc = osmo_apn_from_str(msg->tail, msgb_tailroom(msg), sme->apn);
: if (rc < 0)
: return -EINVAL;
: *l = rc;
: msgb_put(msg, *l);
IMHO this is highly unusual: passing a pointer to
msg->tail and storing some data before doing the msgb_put. All the "legacy"
code that I recall does the msgb_put() first. It would at that point ASSERT if we ever
overrun msgb_tailroom, before anything is memcpying over it.
I would not say it's highly unusual, but rather a common practice in cases when you
don't know how much to `msgb_put()` before calling a buffer filling function, e.g.
`read()` or `recv()`.
Below are grep results for all my local repositories (39 matches total):
```
$ ./gits do grep "msg->tail, msgb_tailroom" | grep
"msgb_tailroom[(]" | wc -l
13
$ ./gits do grep "msg->data, msgb_tailroom" | grep
"msgb_tailroom[(]" | wc -l
9
$ ./gits do grep "msgb_data(msg), msgb_tailroom" | grep
"msgb_tailroom[(]" | wc -l
17
```
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-gprs/+/32644
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: I70be2ff5e7e0fea5e93d7b9963064c38a0382f30
Gerrit-Change-Number: 32644
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Sun, 07 May 2023 06:22:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: comment