dexter has uploaded this change for review. ( 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(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/20/31120/1
diff --git a/src/trau/trau_pcu_ericsson.c b/src/trau/trau_pcu_ericsson.c index 9292f23..852a3ac 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 */