summaryrefslogtreecommitdiff
path: root/asn1/lte-rrc/packet-lte-rrc-template.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-08-21 14:08:42 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-08-21 14:08:42 +0000
commitb3dc1eed1c87e809e98f46e569a131a9346629c2 (patch)
tree1af378b7857b681a8d4a6f6d494432d1860bdbb1 /asn1/lte-rrc/packet-lte-rrc-template.c
parent121d02eaee7c8e22b81344fa976e7e68f68d7535 (diff)
downloadwireshark-b3dc1eed1c87e809e98f46e569a131a9346629c2.tar.gz
Fix Coverity CID's 1063706-1063710: Out-of-bounds read (OVERRUN_STATIC)
svn path=/trunk/; revision=51450
Diffstat (limited to 'asn1/lte-rrc/packet-lte-rrc-template.c')
-rw-r--r--asn1/lte-rrc/packet-lte-rrc-template.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/asn1/lte-rrc/packet-lte-rrc-template.c b/asn1/lte-rrc/packet-lte-rrc-template.c
index 37331a86d6..d0c42258b2 100644
--- a/asn1/lte-rrc/packet-lte-rrc-template.c
+++ b/asn1/lte-rrc/packet-lte-rrc-template.c
@@ -1943,64 +1943,62 @@ dissect_lte_rrc_featureGroupIndRel9Add(tvbuff_t *featureGroupIndRel9Add_tvb, asn
proto_tree_add_bits_item(subtree, hf_lte_rrc_eutra_cap_feat_group_ind_64, featureGroupIndRel9Add_tvb, 31, 1, ENC_BIG_ENDIAN);
}
-
-
/* Functions to get enum values out of indices parsed */
/* If entry not found, return last element of array */
static guint32 drx_lookup_onDurationTimer(guint32 idx)
{
static const guint32 vals[] = {1,2,3,4,5,6,8,10,20,30,40,50,60,80,100,200};
- if (idx < sizeof(vals)) {
+
+ if (idx < (sizeof(vals)/sizeof(guint32))) {
return vals[idx];
}
- else {
- return (sizeof(vals)/(sizeof(guint32)) - 1);
- }
+ return (sizeof(vals)/(sizeof(guint32)) - 1);
}
static guint32 drx_lookup_inactivityTimer(guint32 idx)
{
- static const guint32 vals[] = {1,2,3,4,5,6,8,10,20,30,40,50,60,80,100,200,300,
- 500,750,1280,1920,2560,0};
- if (idx < sizeof(vals)) {
+ static const guint32 vals[] = {
+ 1,2,3,4,5,6,8,10,20,30,40,50,60,80,100,200,300, 500,750,1280,1920,2560,0
+ };
+
+ if (idx < (sizeof(vals)/sizeof(guint32))) {
return vals[idx];
}
- else {
- return (sizeof(vals)/(sizeof(guint32)) - 1);
- }
+ return (sizeof(vals)/(sizeof(guint32)) - 1);
}
static guint32 drx_lookup_retransmissionTimer(guint32 idx)
{
static const guint32 vals[] = {1,2,4,6,8,16,24,33};
- if (idx < sizeof(vals)) {
+
+ if (idx < (sizeof(vals)/sizeof(guint32))) {
return vals[idx];
}
- else {
- return (sizeof(vals)/(sizeof(guint32)) - 1);
- }
+ return (sizeof(vals)/(sizeof(guint32)) - 1);
}
static guint32 drx_lookup_longCycle(guint32 idx)
{
- static const guint32 vals[] = {10,20,32,40,64,80,128,160,256,320,512,640,1024,1280,2048,2560};
- if (idx < sizeof(vals)) {
+ static const guint32 vals[] = {
+ 10,20,32,40,64,80,128,160,256,320,512,640,1024,1280,2048,2560
+ };
+
+ if (idx < (sizeof(vals)/sizeof(guint32))) {
return vals[idx];
}
- else {
- return (sizeof(vals)/(sizeof(guint32)) - 1);
- }
+ return (sizeof(vals)/(sizeof(guint32)) - 1);
}
static guint32 drx_lookup_shortCycle(guint32 idx)
{
- static const guint32 vals[] = {2,5,8,10,16,20,32,40,64,80,128,160,256,320,512,640};
- if (idx < sizeof(vals)) {
+ static const guint32 vals[] = {
+ 2,5,8,10,16,20,32,40,64,80,128,160,256,320,512,640
+ };
+
+ if (idx < (sizeof(vals)/sizeof(guint32))) {
return vals[idx];
}
- else {
- return (sizeof(vals)/(sizeof(guint32)) - 1);
- }
+ return (sizeof(vals)/(sizeof(guint32)) - 1);
}
/* Dedicated DRX config. Currently used to verify that a sensible config is given.