aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-ieee80211.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-11-25 18:06:57 +0000
committerJoão Valverde <j@v6e.pt>2022-11-25 18:06:57 +0000
commit27ea011dd32ad6af3327ec9fe26b82d8b26e7596 (patch)
tree0df5624c784d186b934e9f29edbff6f86a165f3f /epan/dissectors/packet-ieee80211.c
parentade32a12f2bcf8c187cf40189086514694fb5be7 (diff)
802.11: Remove artificial string truncation
The wmem_strbuf_new_label() creates a new buffer with a length limit in octets. With multibyte strings this is likely to generate invalid UTF-8 errors. Remove the artificial limit on the value size. The function proto_tree_add_string() sets the value, and truncating that to an arbitrary limit is not really correct. The display label will be truncated to a preset length by the UI. This mechanism uses ws_label_strcpy() and is designed to avoid the invalid truncation. While here use wmem_strbuf_get_str() instead of wmem_strbuf_finalize(). Accepted best practice is to let the scope free the memory. Removing the finalize call avoids an unnecessary realloc. Fixes #18653.
Diffstat (limited to 'epan/dissectors/packet-ieee80211.c')
-rw-r--r--epan/dissectors/packet-ieee80211.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index 3839ccfbb5..3f0420dba5 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -15199,7 +15199,7 @@ dissect_he_feedback_matrix(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
int ri, ci;
int start_bit_offset = bit_offset;
int start_offset = offset;
- wmem_strbuf_t *angles = wmem_strbuf_new_label(pinfo->pool);
+ wmem_strbuf_t *angles = wmem_strbuf_new(pinfo->pool, NULL);
if (nc == nr) /* If they are the same, reduce Nc by one */
nc -= 1;
@@ -15224,7 +15224,7 @@ dissect_he_feedback_matrix(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
/* Update this */
proto_tree_add_string(tree, hf, tvb, offset,
((start_bit_offset + 7) / 8) - start_offset,
- wmem_strbuf_finalize(angles));
+ wmem_strbuf_get_str(angles));
return bit_offset;
}