dexter has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/31120 )
Change subject: trau_pcu_ericsson: fix broken length check ......................................................................
trau_pcu_ericsson: fix broken length check
The length check bits_len - offs < 0 does not work properly with unsigned variables. Lets rearange this so that it works.
Change-Id: I9e0cd5d36c517b9198e0dc1bec0477a2ee2fb869 Fixes: CID#307058, CID#307057 --- M src/trau/trau_pcu_ericsson.c 1 file changed, 2 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved
diff --git a/src/trau/trau_pcu_ericsson.c b/src/trau/trau_pcu_ericsson.c index 9292f23..fa0d5da 100644 --- a/src/trau/trau_pcu_ericsson.c +++ b/src/trau/trau_pcu_ericsson.c @@ -270,7 +270,7 @@ * greater then the length of the bits */ if (bits_len > bits_map_len) return -EINVAL; - if (bits_len - offs < 0) + if (bits_len <= offs) return -EINVAL;
/* Advance to the position where the data is stored */ @@ -331,7 +331,7 @@ /* (see above) */ if (bits_len > bits_map_len) return -EINVAL; - if (bits_len - offs < 0) + if (bits_len <= offs) return -EINVAL;
/* Advance to the position where the data is located */