From Michael Lum:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 20 Jan 2009 19:41:29 +0000 (19:41 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 20 Jan 2009 19:41:29 +0000 (19:41 +0000)
Fixed SPC digit translation
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3213

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27275 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-ansi_683.c

index 0f4c456cade5b6fc5ec7bb2268bb16b647d74ada..cde6f8e2f228ef8679a4cd6e71b9faa7743f486e 100644 (file)
@@ -1493,30 +1493,27 @@ static void
 for_param_block_val_spc(tvbuff_t *tvb, proto_tree *tree, guint len, guint32 offset)
 {
     guint32    saved_offset;
-    guint32    value, count, i;
+    guint32    value;
 
     EXACT_DATA_CHECK(len, 3);
 
     saved_offset = offset;
 
-    value = tvb_get_ntoh24(tvb, offset);
+    value = tvb_get_guint8(tvb, offset++);
+    bigbuf[0] = bcd_digits[(value & 0x0f)];
+    bigbuf[1] = bcd_digits[(value & 0xf0) >> 4];
 
-    count = 6; /* 2 x 3 octets */
+    value = tvb_get_guint8(tvb, offset++);
+    bigbuf[2] = bcd_digits[(value & 0x0f)];
+    bigbuf[3] = bcd_digits[(value & 0xf0) >> 4];
 
-    for (i=0; i < count; i++)
-    {
-       bigbuf[i] = bcd_digits[(value & 0x0f)];
-
-       if ((i + 1) < count)
-       {
-           bigbuf[i+1] = bcd_digits[(value & 0xf0) >> 4];
-           i++;
-       }
-    }
-    bigbuf[i] = '\0';
+    value = tvb_get_guint8(tvb, offset++);
+    bigbuf[4] = bcd_digits[(value & 0x0f)];
+    bigbuf[5] = bcd_digits[(value & 0xf0) >> 4];
+    bigbuf[6] = '\0';
 
     proto_tree_add_none_format(tree, hf_ansi_683_none,
-       tvb, offset, len,
+       tvb, saved_offset, len,
        "Service programming code: %s",
        bigbuf);
 }