diff options
author | Diederik de Groot <ddegroot@talon.nl> | 2014-08-26 18:33:54 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2014-08-26 18:58:39 +0000 |
commit | d6aa77d83b0b5335754b40c0d84af08252626c95 (patch) | |
tree | ccb1f682ef76e4198acf8d4f5e8fa19a56ff5dee /epan/dissectors/packet-skinny.c | |
parent | efd95341e81ceb39127b4df2cee855b6fd9a2b0b (diff) |
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>
Diffstat (limited to 'epan/dissectors/packet-skinny.c')
-rw-r--r-- | epan/dissectors/packet-skinny.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/epan/dissectors/packet-skinny.c b/epan/dissectors/packet-skinny.c index 123036527b..047ff25cd3 100644 --- a/epan/dissectors/packet-skinny.c +++ b/epan/dissectors/packet-skinny.c @@ -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); } /* |