aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-e212.c
diff options
context:
space:
mode:
authordimeg <dimeg@f5534014-38df-0310-8fa8-9805f1628bb7>2009-11-27 22:57:50 +0000
committerdimeg <dimeg@f5534014-38df-0310-8fa8-9805f1628bb7>2009-11-27 22:57:50 +0000
commit7d3f9f3c5483cd059f7880a5c37dc023ada29c52 (patch)
tree1735a55435544fcafa2d86bae3f28aabee909421 /epan/dissectors/packet-e212.c
parent7b6687833c0a68e9fa524df75bfbd41816178efb (diff)
Expert info when E.212 MCC/MNC contain non-decimal digits
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@31102 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-e212.c')
-rw-r--r--epan/dissectors/packet-e212.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/epan/dissectors/packet-e212.c b/epan/dissectors/packet-e212.c
index d44d5b5bf8..b74bdab4fb 100644
--- a/epan/dissectors/packet-e212.c
+++ b/epan/dissectors/packet-e212.c
@@ -32,6 +32,7 @@
#include <epan/packet.h>
#include "packet-e212.h"
+#include "expert.h"
/*
@@ -1594,20 +1595,25 @@ static int hf_E212_mnc = -1;
static int hf_E212_msin = -1;
/*
- * 8 7 6 5 4 3 2 1
- * MCC digit 2 MCC digit 1 octet x
- * MNC digit 3 MCC digit 3 octet x+1
- * MNC digit 2 MNC digit 1 octet x+2
+ * 8 7 6 5 4 3 2 1
+ * +---+---+---+---+---+---+---+---+
+ * | MCC digit 2 | MCC digit 1 | octet x
+ * +---------------+---------------+
+ * | MNC digit 3 | MCC digit 3 | octet x+1
+ * +---------------+---------------+
+ * | MNC digit 2 | MNC digit 1 | octet x+2
+ * +---------------+---------------+
*/
int
-dissect_e212_mcc_mnc(tvbuff_t *tvb, proto_tree *tree, int offset){
+dissect_e212_mcc_mnc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset){
int start_offset;
guint8 octet;
guint16 mcc, mnc;
guint8 mcc1, mcc2, mcc3, mnc1, mnc2, mnc3;
+ proto_item *item;
start_offset = offset;
/* Mobile country code MCC */
@@ -1629,11 +1635,17 @@ dissect_e212_mcc_mnc(tvbuff_t *tvb, proto_tree *tree, int offset){
if (mnc3 != 0xf) {
mnc = 10 * mnc + mnc3;
}
- proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc );
- proto_tree_add_uint_format(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc,
+ item = proto_tree_add_uint(tree, hf_E212_mcc , tvb, start_offset, 2, mcc );
+ if ((mcc1 > 9) || (mcc2 > 9) || (mcc3 > 9))
+ expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MCC contains non-decimal digits");
+
+ item = proto_tree_add_uint_format(tree, hf_E212_mnc , tvb, start_offset + 1, 2, mnc,
"Mobile Network Code (MNC): %s (%u)",
val_to_str(mcc * 1000 + mnc, mcc_mnc_codes, "Unknown"),
mnc);
+ if ((mnc1 > 9) || (mnc2 > 9) || ((mnc3 > 9) && (mnc3 != 0x0f)))
+ expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "MNC contains non-decimal digits");
+
offset++;
return offset;
}