From 10f36f219c46342af6399ea6e0d8106910b3e8f0 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 22 May 2021 11:45:10 -0700 Subject: [PATCH] oran: clean up write_pdu_label_and_info(). Declare it as being printflike, so that the compiler does format-vs-argument-list checking. Fix the error that found. Make the string buffer into which it formats automatic, so that it's thread-safe. --- epan/dissectors/packet-oran.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/epan/dissectors/packet-oran.c b/epan/dissectors/packet-oran.c index 95c690b023..4e2f53e4aa 100755 --- a/epan/dissectors/packet-oran.c +++ b/epan/dissectors/packet-oran.c @@ -352,6 +352,9 @@ static const range_string udCompParams[] = { }; #endif +static void write_pdu_label_and_info(proto_item *ti1, proto_item *ti2, + packet_info *pinfo, const char *format, ...) G_GNUC_PRINTF(4, 5); + /* Write the given formatted text to: - the info column (if pinfo != NULL) - 1 or 2 other labels (optional) @@ -360,7 +363,7 @@ static void write_pdu_label_and_info(proto_item *ti1, proto_item *ti2, packet_info *pinfo, const char *format, ...) { #define MAX_INFO_BUFFER 256 - static char info_buffer[MAX_INFO_BUFFER]; + char info_buffer[MAX_INFO_BUFFER]; va_list ap; if ((ti1 == NULL) && (ti2 == NULL) && (pinfo == NULL)) { @@ -388,7 +391,7 @@ write_section_info(proto_item *section_heading, packet_info *pinfo, proto_item * { switch (num_prbx) { case 0: - write_pdu_label_and_info(section_heading, protocol_item, pinfo, ", Id: %d (all PRBs"); + write_pdu_label_and_info(section_heading, protocol_item, pinfo, ", Id: %d (all PRBs", section_id); break; case 1: write_pdu_label_and_info(section_heading, protocol_item, pinfo, ", Id: %d (PRB: %d)", section_id, start_prbx);