From 39608dc04557ac050de6a05a6d41239fc18d9eb8 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 18 Apr 2010 22:47:22 +0200 Subject: GPRS: Fix calculation of 'Extension Length' in GPRS Cell Options The actual 'Extension Length' field in the 'GPRS Cell Options' IE is coded the length - 1, not the full length. Without this fix, the code has an off-by-one error. --- openbsc/src/rest_octets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'openbsc/src') diff --git a/openbsc/src/rest_octets.c b/openbsc/src/rest_octets.c index fd56caf81..039d2c83a 100644 --- a/openbsc/src/rest_octets.c +++ b/openbsc/src/rest_octets.c @@ -327,12 +327,12 @@ static int append_gprs_cell_opt(struct bitvec *bv, bitvec_set_bit(bv, 1); if (!gco->ext_info.egprs_supported) { /* 6bit length of extension */ - bitvec_set_uint(bv, 1 + 3, 6); + bitvec_set_uint(bv, (1 + 3)-1, 6); /* EGPRS supported in the cell */ bitvec_set_bit(bv, 0); } else { /* 6bit length of extension */ - bitvec_set_uint(bv, 1 + 5 + 3, 6); + bitvec_set_uint(bv, (1 + 5 + 3)-1, 6); /* EGPRS supported in the cell */ bitvec_set_bit(bv, 1); /* 1bit EGPRS PACKET CHANNEL REQUEST */ -- cgit v1.2.3