diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-02-17 12:19:33 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-02-17 20:20:08 +0000 |
commit | 397d32b863b640ccded140acd6eec94da367264b (patch) | |
tree | c47745b727ebf6928a1b548485d4868f3f5c0119 | |
parent | 86f2ff6ec027514d067fd6ec054b6b2fa7c3afe1 (diff) |
dcerpc_decode_as_change() doesn't need to change the old binding.
The search doesn't use the fields we change (if it did, we probably
shouldn't change them, as the old binding might not be found), so don't
change them.
Instead, when we allocate a *new* binding structure, put the new values
into *that* structure.
Squelches a "casting away constness" warning.
Change-Id: I6dbd1a4cbc2415373f4926f443f9756c8113c0be
Reviewed-on: https://code.wireshark.org/review/25841
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | epan/dissectors/packet-dcerpc.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index 9baa032b3e..11838a3de1 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -977,24 +977,24 @@ decode_dcerpc_binding_reset(const char *name _U_, gconstpointer pattern) static gboolean dcerpc_decode_as_change(const char *name, gconstpointer pattern, gpointer handle, gchar* list_name) { - decode_dcerpc_bind_values_t *binding = (decode_dcerpc_bind_values_t*)pattern; + const decode_dcerpc_bind_values_t *binding = (const decode_dcerpc_bind_values_t*)pattern; decode_dcerpc_bind_values_t *stored_binding; guid_key *key = *((guid_key**)handle); - - binding->ifname = g_string_new(list_name); - binding->uuid = key->guid; - binding->ver = key->ver; - /* remove a probably existing old binding */ decode_dcerpc_binding_reset(name, binding); - /* clone the new binding and append it to the list */ + /* + * Clone the new binding, update the changing parts, and append it + * to the list. + */ stored_binding = g_new(decode_dcerpc_bind_values_t,1); *stored_binding = *binding; copy_address(&stored_binding->addr_a, &binding->addr_a); copy_address(&stored_binding->addr_b, &binding->addr_b); - stored_binding->ifname = g_string_new(binding->ifname->str); + stored_binding->ifname = g_string_new(list_name); + stored_binding->uuid = key->guid; + stored_binding->ver = key->ver; decode_dcerpc_bindings = g_slist_append (decode_dcerpc_bindings, stored_binding); |