Add a sixteenth element to all BCD digit sets to avoid garbage values when

decoding corrupt bytes. Some of these digit sets could probably be
deduplicated...

svn path=/trunk/; revision=54224
This commit is contained in:
Evan Huus 2013-12-18 15:54:32 +00:00
parent 197c2ffac6
commit 8f665d9b36
9 changed files with 21 additions and 28 deletions

View File

@ -568,7 +568,7 @@ static int dissect_ansi_map_SystemMyTypeCode(gboolean implicit_tag _U_, tvbuff_t
static dgt_set_t Dgt_tbcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#'
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#','?'
}
};

View File

@ -1356,7 +1356,7 @@ static int dissect_ansi_map_SystemMyTypeCode(gboolean implicit_tag _U_, tvbuff_t
static dgt_set_t Dgt_tbcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#'
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#','?'
}
};

View File

@ -620,7 +620,7 @@ dissect_bssap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
static dgt_set_t Dgt_tbcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#'
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#','?'
}
};
#endif
@ -628,7 +628,7 @@ static dgt_set_t Dgt_tbcd = {
static dgt_set_t Dgt1_9_bcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?'
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?','?'
}
};
/* Assumes the rest of the tvb contains the digits to be turned into a string

View File

@ -1928,14 +1928,14 @@ guint16 elem_v_short(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, gint p
static dgt_set_t Dgt_tbcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#'
'0','1','2','3','4','5','6','7','8','9','?','B','C','*','#','?'
}
};
static dgt_set_t Dgt1_9_bcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?'
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?','?'
}
};

View File

@ -59,14 +59,6 @@
/* PROTOTYPES/FORWARDS */
typedef guint16 (*elem_fcn)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string, int string_len);
typedef void (*msg_fcn)(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len);
#if 0
/* XXX moved to tvbuff.h, clean up later */
typedef struct dgt_set_t
{
unsigned char out[15];
}
dgt_set_t;
#endif
int my_dgt_tbcd_unpack(
char *out, /* ASCII pattern out */
guchar *in, /* packed pattern in */

View File

@ -566,7 +566,7 @@ gint ett_gsm_dtap_elem[NUM_GSM_DTAP_ELEM];
static dgt_set_t Dgt_mbcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','*','#','a','b','c'
'0','1','2','3','4','5','6','7','8','9','*','#','a','b','c','?'
}
};

View File

@ -43,6 +43,7 @@
#include "packet-acse.h"
#include "packet-ros.h"
#include "packet-rtse.h"
#include "packet-p7.h"
#include "packet-p1.h"
#include <epan/strutil.h>
@ -123,7 +124,7 @@ static int proto_p7 = -1;
#define ub_ua_restrictions 16
/*--- End of included file: packet-p7-val.h ---*/
#line 60 "../../asn1/p7/packet-p7-template.c"
#line 61 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-hf.c ---*/
@ -495,7 +496,7 @@ static int hf_p7_T_entry_class_problem_entry_class_not_subscribed = -1;
static int hf_p7_T_entry_class_problem_inappropriate_entry_class = -1;
/*--- End of included file: packet-p7-hf.c ---*/
#line 62 "../../asn1/p7/packet-p7-template.c"
#line 63 "../../asn1/p7/packet-p7-template.c"
/* Initialize the subtree pointers */
static gint ett_p7 = -1;
@ -637,7 +638,7 @@ static gint ett_p7_RTSE_apdus = -1;
static gint ett_p7_RTABapdu = -1;
/*--- End of included file: packet-p7-ett.c ---*/
#line 66 "../../asn1/p7/packet-p7-template.c"
#line 67 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-table.c ---*/
@ -680,7 +681,7 @@ static const value_string p7_err_code_string_vals[] = {
/*--- End of included file: packet-p7-table.c ---*/
#line 68 "../../asn1/p7/packet-p7-template.c"
#line 69 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-fn.c ---*/
@ -4083,7 +4084,7 @@ static void dissect_RTSE_apdus_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pr
/*--- End of included file: packet-p7-fn.c ---*/
#line 70 "../../asn1/p7/packet-p7-template.c"
#line 71 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-table11.c ---*/
@ -4115,7 +4116,7 @@ static const ros_opr_t p7_opr_tab[] = {
/*--- End of included file: packet-p7-table11.c ---*/
#line 72 "../../asn1/p7/packet-p7-template.c"
#line 73 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-table21.c ---*/
#line 1 "../../asn1/p7/packet-p7-table21.c"
@ -4154,7 +4155,7 @@ static const ros_err_t p7_err_tab[] = {
/*--- End of included file: packet-p7-table21.c ---*/
#line 73 "../../asn1/p7/packet-p7-template.c"
#line 74 "../../asn1/p7/packet-p7-template.c"
static const ros_info_t p7_ros_info = {
"P7",
@ -5634,7 +5635,7 @@ void proto_register_p7(void) {
NULL, HFILL }},
/*--- End of included file: packet-p7-hfarr.c ---*/
#line 92 "../../asn1/p7/packet-p7-template.c"
#line 93 "../../asn1/p7/packet-p7-template.c"
};
/* List of subtrees */
@ -5778,7 +5779,7 @@ void proto_register_p7(void) {
&ett_p7_RTABapdu,
/*--- End of included file: packet-p7-ettarr.c ---*/
#line 98 "../../asn1/p7/packet-p7-template.c"
#line 99 "../../asn1/p7/packet-p7-template.c"
};
module_t *p7_module;
@ -5837,7 +5838,7 @@ void proto_reg_handoff_p7(void) {
/*--- End of included file: packet-p7-dis-tab.c ---*/
#line 124 "../../asn1/p7/packet-p7-template.c"
#line 125 "../../asn1/p7/packet-p7-template.c"
/* APPLICATION CONTEXT */

View File

@ -2738,8 +2738,8 @@ tvb_bytes_to_str_punct(tvbuff_t *tvb, const gint offset, const gint len, const g
*/
static dgt_set_t Dgt1_9_bcd = {
{
/* 0 1 2 3 4 5 6 7 8 9 a b c d e */
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?'
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f*/
'0','1','2','3','4','5','6','7','8','9','?','?','?','?','?','?'
}
};
const gchar *

View File

@ -675,7 +675,7 @@ WS_DLL_PUBLIC gchar *tvb_bytes_to_str(tvbuff_t *tvb, const gint offset,
*/
typedef struct dgt_set_t
{
const unsigned char out[15];
const unsigned char out[16];
}
dgt_set_t;