daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/33771 )
Change subject: osmo_io: Fix length calculation in iofd_handle_segmentation() ......................................................................
osmo_io: Fix length calculation in iofd_handle_segmentation()
We need to account for the fact that segmentation_cb() could have changed the length by calling msgb_pull(). Calculate the new len according to the new tail/data pointers.
Change-Id: I5486ddc0d3345e92b20cbc6e5bcf2cefea3958c8 --- M src/core/osmo_io.c 1 file changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/71/33771/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index b4c8eb6..37127c1 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -267,8 +267,8 @@
/* Trim the original msgb to size. Don't use msgb_trim because we need to reference * msg->data from before it might have been modified by the segmentation_cb(). */ - msg->len = expected_len; msg->tail = data + expected_len; + msg->len = msg->tail - msg->data; return IOFD_SEG_ACT_HANDLE_MORE;
defer: