Skinny:
Do not try to create a wmem_strbuf whose size is bigger than the max size allowed -> using wmem_strbuf_new instead of wmem_strbuf_sized_new (Evan Huus) While we are at it, fix errors spotted by the pre-commit tools/SkinnyProtocolOptimized -> Did not get any, can you specify which errors ? (Pascal Quantin) FT_IPv6: 'ENC_BIG_ENDIAN | ENC_NA' -> 'ENC_NA' only (2) (Pascal Quantin) Revert back to wmem_strbuf_sized_new instead of wmem_strbuf_new (Pascal Quantin) Use wmem_strbuf_sized_new maxlength = 0 (Pascal Quantin) Bug: 10409 Bug: 10410 Change-Id: Iebfcb53bc0a6289e02d10c38ecb717aa5c89389e Reviewed-on: https://code.wireshark.org/review/3862 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
parent
efd95341e8
commit
d6aa77d83b
|
@ -2263,7 +2263,7 @@ dissect_skinny_ipv4or6(ptvcursor_t *cursor, int hfindex_ipv4, int hfindex_ipv6,
|
|||
}
|
||||
|
||||
static void
|
||||
dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length, guint32 maxlength)
|
||||
dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length)
|
||||
{
|
||||
proto_item *item = NULL;
|
||||
proto_tree *tree = ptvcursor_tree(cursor);
|
||||
|
@ -2279,9 +2279,6 @@ dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length, gu
|
|||
if (length == 0) {
|
||||
length = tvb_strnlen(tvb, offset, -1) + 1;
|
||||
}
|
||||
if (length >= maxlength) {
|
||||
length = maxlength;
|
||||
}
|
||||
|
||||
disp_string = (const gchar *) tvb_memdup(wmem_packet_scope(), tvb, offset, length);
|
||||
item = proto_tree_add_item(tree, hfindex, tvb, offset, length, ENC_ASCII | ENC_NA);
|
||||
|
@ -2291,7 +2288,7 @@ dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length, gu
|
|||
return;
|
||||
}
|
||||
|
||||
wmem_new = wmem_strbuf_sized_new(wmem_packet_scope(), 0, maxlength);
|
||||
wmem_new = wmem_strbuf_sized_new(wmem_packet_scope(), length, 0);
|
||||
|
||||
while (*disp_string) {
|
||||
replacestr = NULL;
|
||||
|
@ -5265,7 +5262,7 @@ handle_SoftKeyTemplateResMessage(ptvcursor_t *cursor, packet_info * pinfo _U_)
|
|||
for (counter_2 = 0; counter_2 < 32; counter_2++) {
|
||||
if (counter_2 < totalSoftKeyCount) {
|
||||
ptvcursor_add_text_with_subtree(cursor, SUBTREE_UNDEFINED_LENGTH, ett_skinny_tree, "definition [%d / %d]", counter_2 + 1, totalSoftKeyCount);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_softKeyLabel, 16, 16);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_softKeyLabel, 16);
|
||||
ptvcursor_add(cursor, hf_skinny_softKeyEvent, 4, ENC_LITTLE_ENDIAN);
|
||||
} else {
|
||||
ptvcursor_advance(cursor, 20);
|
||||
|
@ -5410,7 +5407,7 @@ static void
|
|||
handle_DisplayPromptStatusMessage(ptvcursor_t *cursor, packet_info * pinfo _U_)
|
||||
{
|
||||
ptvcursor_add(cursor, hf_skinny_timeOutValue, 4, ENC_LITTLE_ENDIAN);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_promptStatus, 32, 32);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_promptStatus, 32);
|
||||
si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
|
||||
ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN);
|
||||
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
|
||||
|
@ -5444,7 +5441,7 @@ static void
|
|||
handle_DisplayNotifyMessage(ptvcursor_t *cursor, packet_info * pinfo _U_)
|
||||
{
|
||||
ptvcursor_add(cursor, hf_skinny_timeOutValue, 4, ENC_LITTLE_ENDIAN);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 32, 32);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 32);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5631,7 +5628,7 @@ handle_DisplayPriNotifyMessage(ptvcursor_t *cursor, packet_info * pinfo _U_)
|
|||
{
|
||||
ptvcursor_add(cursor, hf_skinny_timeOutValue, 4, ENC_LITTLE_ENDIAN);
|
||||
ptvcursor_add(cursor, hf_skinny_priority, 4, ENC_LITTLE_ENDIAN);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 32, 32);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 32);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -6825,7 +6822,7 @@ static void
|
|||
handle_DisplayNotifyV2Message(ptvcursor_t *cursor, packet_info * pinfo _U_)
|
||||
{
|
||||
ptvcursor_add(cursor, hf_skinny_timeOutValue, 4, ENC_LITTLE_ENDIAN);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 0, 32);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -6840,7 +6837,7 @@ handle_DisplayPriNotifyV2Message(ptvcursor_t *cursor, packet_info * pinfo _U_)
|
|||
{
|
||||
ptvcursor_add(cursor, hf_skinny_timeOutValue, 4, ENC_LITTLE_ENDIAN);
|
||||
ptvcursor_add(cursor, hf_skinny_priority, 4, ENC_LITTLE_ENDIAN);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 0, 97);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_notify, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -6858,7 +6855,7 @@ handle_DisplayPromptStatusV2Message(ptvcursor_t *cursor, packet_info * pinfo _U_
|
|||
ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN);
|
||||
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
|
||||
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_promptStatus, 0, 97);
|
||||
dissect_skinny_displayLabel(cursor, hf_skinny_promptStatus, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -268,7 +268,7 @@ dissect_skinny_ipv4or6(ptvcursor_t *cursor, int hfindex_ipv4, int hfindex_ipv6,
|
|||
}
|
||||
|
||||
static void
|
||||
dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length, guint32 maxlength)
|
||||
dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length)
|
||||
{
|
||||
proto_item *item = NULL;
|
||||
proto_tree *tree = ptvcursor_tree(cursor);
|
||||
|
@ -284,9 +284,6 @@ dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length, gu
|
|||
if (length == 0) {
|
||||
length = tvb_strnlen(tvb, offset, -1) + 1;
|
||||
}
|
||||
if (length >= maxlength) {
|
||||
length = maxlength;
|
||||
}
|
||||
|
||||
disp_string = (const gchar *) tvb_memdup(wmem_packet_scope(), tvb, offset, length);
|
||||
item = proto_tree_add_item(tree, hfindex, tvb, offset, length, ENC_ASCII | ENC_NA);
|
||||
|
@ -296,7 +293,7 @@ dissect_skinny_displayLabel(ptvcursor_t *cursor, int hfindex, guint32 length, gu
|
|||
return;
|
||||
}
|
||||
|
||||
wmem_new = wmem_strbuf_sized_new(wmem_packet_scope(), 0, maxlength);
|
||||
wmem_new = wmem_strbuf_sized_new(wmem_packet_scope(), length, 0);
|
||||
|
||||
while (*disp_string) {
|
||||
replacestr = NULL;
|
||||
|
|
|
@ -474,11 +474,11 @@ def xml2obj(src):
|
|||
|
||||
if self.subtype == "DisplayLabel":
|
||||
if self.basemessage.dynamic == "yes":
|
||||
ret += self.indent_out('dissect_skinny_displayLabel(cursor, hf_skinny_%s, 0, %d);\n' %(self.name, self.intsize))
|
||||
ret += self.indent_out('dissect_skinny_displayLabel(cursor, hf_skinny_%s, 0);\n' %(self.name))
|
||||
elif self.size_fieldname:
|
||||
ret += self.indent_out('dissect_skinny_displayLabel(cursor, hf_skinny_%s, %s, %d);\n' %(self.name, self.size_fieldname, self.intsize))
|
||||
ret += self.indent_out('dissect_skinny_displayLabel(cursor, hf_skinny_%s, %s);\n' %(self.name, self.size_fieldname))
|
||||
else:
|
||||
ret += self.indent_out('dissect_skinny_displayLabel(cursor, hf_skinny_%s, %s, %d);\n' %(self.name, self.size, self.intsize))
|
||||
ret += self.indent_out('dissect_skinny_displayLabel(cursor, hf_skinny_%s, %s);\n' %(self.name, self.size))
|
||||
|
||||
elif self.basemessage.dynamic == "yes":
|
||||
ret += self.indent_out('%s_len = tvb_strnlen(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor), -1)+1;\n' %self.name)
|
||||
|
|
Loading…
Reference in New Issue