diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-07-06 15:34:38 +0200 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-07-06 23:00:40 +0000 |
commit | f2b4daf4005d60eef7e34e2e6ebf4fe487d3c255 (patch) | |
tree | 1fac15d7bcbc381c5e0a3a6602e7edd20e574e39 /plugins/wimax | |
parent | ec6a22dc3ba8e2d438b34d892d6a40e1be2a28f2 (diff) |
Add printf-format annotations, fix garbage
The WRETH dissector showed up some garbage in the column display. Upon
further inspection, it turns out that the format string had a trailing
percent sign which caused (unsigned)-1 to be returned by
g_printf_string_upper_bound (in emem_strdup_vprintf). Then ep_alloc is
called with (unsigned)-1 + 1 = 0 memory, no wonder that garbage shows
up. ASAN could not even catch this error because EP is in charge of
this.
So, start adding G_GNUC_PRINTF annotations in each header that uses
the "fmt" or "format" paramters (grepped + awk). This revealed some
other errors. The NCP2222 dissector was missing a format string (not
a security vuln though).
Many dissectors used val_to_str with a constant (but empty) string,
these have been replaced by val_to_str_const. ASN.1 dissectors
were regenerated for this.
Minor: the mate plugin used "%X" instead of "%p" for a pointer type.
The ncp2222 dissector and wimax plugin gained modelines.
Change-Id: I7f3f6a3136116f9b251719830a39a7b21646f622
Reviewed-on: https://code.wireshark.org/review/2881
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'plugins/wimax')
-rw-r--r-- | plugins/wimax/msg_arq.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/wimax/msg_arq.c b/plugins/wimax/msg_arq.c index c7d538b259..50d6a86dc6 100644 --- a/plugins/wimax/msg_arq.c +++ b/plugins/wimax/msg_arq.c @@ -339,7 +339,7 @@ static void dissect_mac_mgmt_msg_arq_feedback_decoder(tvbuff_t *tvb, packet_info arq_fb_item = proto_tree_add_protocol_format(arq_feedback_tree, proto_mac_mgmt_msg_arq_decoder, tvb, offset, tvb_len, "ARQ_Feedback_IE"); proto_item_append_text(arq_fb_item, ", CID: %u, %s ARQ feedback IE, %s, BSN: %u", - arq_cid, arq_last ? "Last" : "More", val_to_str(arq_ack_type, vals_arq_ack_type, ""), arq_bsn); + arq_cid, arq_last ? "Last" : "More", val_to_str_const(arq_ack_type, vals_arq_ack_type, ""), arq_bsn); if (arq_ack_type != ARQ_CUMULATIVE_ACK_ENTRY) { proto_item_append_text(arq_fb_item, ", %u ACK Map(s)", arq_num_ack_maps); } @@ -442,3 +442,15 @@ proto_reg_handoff_mac_mgmt_msg_arq(void) dissector_add_uint("wmx.mgmtmsg", MAC_MGMT_MSG_ARQ_RESET, arq_handle); } +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ |