summaryrefslogtreecommitdiffstats
path: root/bsc
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-08-12 12:13:32 +0000
committerlaforge <laforge@osmocom.org>2020-08-13 05:36:26 +0000
commitba9c51b2239406761b10453b5a8594a30148a0b5 (patch)
tree8ee3bb07f08a78d9ad9a0d2554c7a992a1f1f1cd /bsc
parentf793a7e464742864245c0197ce9cad6a205c8936 (diff)
bsc CBSP: f_gen_page(): fix generated payload size range
Fix the length calculation to provide a range of [1..82]. f_rnd_int() generates [0..max[ (i.e., < max), so f_gen_page() so far has a payload len range of [0..81]. We want no zero payload, and we want a maximum of 82 bytes (page max of 88 minus 6 header bytes). Change-Id: Id521b6038a23dc8e71ea25475bcdef7bc8917531
Diffstat (limited to 'bsc')
-rw-r--r--bsc/BSC_Tests_CBSP.ttcn5
1 files changed, 4 insertions, 1 deletions
diff --git a/bsc/BSC_Tests_CBSP.ttcn b/bsc/BSC_Tests_CBSP.ttcn
index 2399c3a..f54de9b 100644
--- a/bsc/BSC_Tests_CBSP.ttcn
+++ b/bsc/BSC_Tests_CBSP.ttcn
@@ -136,7 +136,10 @@ private function f_cbsp_init_tail() runs on cbsp_test_CT {
}
function f_gen_page() return CBSP_IE {
- var integer len := f_rnd_int(82);
+ /* The maximum CBSP page payload space is 88, but 6 bytes of payload header are added in the first page: the
+ * maximum length generated here thus is 82. The minimum generated length is 1 (avoiding zero length).
+ * note, f_rnd_int(82) returns [0..81], so this results in a len ranging [1..82]: */
+ var integer len := 1 + f_rnd_int(82);
var octetstring payload := f_rnd_octstring(len);
return valueof(ts_CbspMsgContent(payload, len));
}