Wireshark-bugs: [Wireshark-bugs] [Bug 8070] Patch for packet-coap.c
Date: Mon, 03 Feb 2014 00:28:24 +0000

Comment # 23 on bug 8070 from
(In reply to comment #22)
> (In reply to comment #18)
> > Shoichi:
> > 
> > While looking at packet-coap.c I noticed what seems to me to be a minor bug
> > in dissect_coap_opt_uri_query().
> > 
> > Specifically: it seems to me that the g_strlcat marked below should be
> > concatenating to 'coap_uri_query' and not to 'coap_uri_str'.
> > 
> > If you can confirm, I'll make the change.
> > 
> > Thanks
> > 
> > -------
> > 
> > dissect_coap_opt_uri_query(tvbuff_t *tvb, proto_item *head_item,proto_tree
> > *subtree, gint offset, gint opt_length)
> > {
> > 	const guint8 *str = NULL;
> > 
> > 	[...]
> > 
> > 	if (opt_length == 0) {
> > 		str = nullstr;
> > 	} else {
> > 		str = [...];
> > ==>		g_strlcat(coap_uri_str, str, sizeof(coap_uri_str));
> > 	}
> > 	[...]
> > 
> > }
> 
> You are correct.  There are copy-and-paste problem.

I think the patch should be the following.

Index: packet-coap.c
===================================================================
--- packet-coap.c       (revision 54990)
+++ packet-coap.c       (working copy)
@@ -380,15 +380,15 @@
        const guint8 *str = NULL;

        if (coap_uri_query[0] == '\0')
-               g_strlcat(coap_uri_query, "?", sizeof(coap_uri_str));
+               g_strlcat(coap_uri_query, "?", sizeof(coap_uri_query));
        else
-               g_strlcat(coap_uri_query, "&", sizeof(coap_uri_str));
+               g_strlcat(coap_uri_query, "&", sizeof(coap_uri_query));

        if (opt_length == 0) {
                str = nullstr;
        } else {
                str = tvb_get_string(wmem_packet_scope(), tvb, offset,
opt_length);
-               g_strlcat(coap_uri_str, str, sizeof(coap_uri_str));
+               g_strlcat(coap_uri_query, str, sizeof(coap_uri_query));
        }

        proto_tree_add_string(subtree, hf_coap_opt_uri_query, tvb, offset,
opt_length, str);


You are receiving this mail because:
  • You are watching all bug changes.