dexter submitted this change.

View Change

Approvals: Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved
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(-)

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 */

To view, visit change 31120. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I9e0cd5d36c517b9198e0dc1bec0477a2ee2fb869
Gerrit-Change-Number: 31120
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-MessageType: merged