Ethereal-dev: [Ethereal-dev] Patch for packet-gsm_sms.c : offsets and TP-PID in SMS-SUBMIT-REP

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Victor Stratan <hidralisk@xxxxxxxxx>
Date: Mon, 13 Dec 2004 10:48:23 -0800 (PST)
Hello,

Fix:
Corrected offset calculation and added TP-PID decoding
in SMS-SUBMIT-REPORT decoding based on
3GPP TS 23.040 V6.5.0
9.2.3.11

=====
Live long and prosper,
  Vik

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
--- ethereal-2004-12-13/epan/dissectors/packet-gsm_sms.c	2004-12-12 01:47:12.000000000 +0200
+++ ethereal-2004-12-13-new/epan/dissectors/packet-gsm_sms.c	2004-12-13 19:16:26.000000000 +0200
@@ -2239,10 +2239,24 @@
     pi = tvb_get_guint8(tvb, offset);
 
     dis_field_pi(tvb, tree, offset, pi);
-
     offset++;
+
     dis_field_scts(tvb, tree, &offset);
 
+    if (pi & 0x01) {
+	if (length <= (offset - saved_offset)) {
+	    proto_tree_add_text(tree,
+		tvb, offset, -1,
+		"Short Data (?)");
+	    return;
+	}
+
+	oct = tvb_get_guint8(tvb, offset);
+
+	dis_field_pid(tvb, tree, offset, oct);
+	offset++;
+    }
+
     if (pi & 0x02)
     {
 	if (length <= (offset - saved_offset))
@@ -2253,10 +2267,10 @@
 	    return;
 	}
 
-	offset++;
 	oct = tvb_get_guint8(tvb, offset);
 
 	dis_field_dcs(tvb, tree, offset, oct, &seven_bit, &eight_bit, &ucs2, &compressed);
+	offset++;
     }
 
     if (pi & 0x04)
@@ -2269,17 +2283,15 @@
 	    return;
 	}
 
-	offset++;
 	oct = tvb_get_guint8(tvb, offset);
 	udl = oct;
 
 	DIS_FIELD_UDL(tree, offset);
+	offset++;
     }
 
     if (udl > 0)
     {
-	offset++;
-
 	dis_field_ud(tvb, tree, offset, length - (offset - saved_offset), udhi, udl,
 	    seven_bit, eight_bit, ucs2, compressed);
     }