rpc: take a file-scope copy of some RPC procedures

The original may be freed out from underneath us if a duplicate is registered.
Thanks to Bruce Fields for pointing out one case of this I'd missed.

Also replace a bunch of manual "foo.field = 0" with just wmem_new0() instead.

Bug: 10636
Change-Id: I342bd732f062b0a191cbbf5ae417356385d2fd53
Reviewed-on: https://code.wireshark.org/review/5046
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
Evan Huus 2014-11-01 16:36:01 -04:00
parent cd93af0ed1
commit bfc5483174
1 changed files with 3 additions and 11 deletions

View File

@ -1625,7 +1625,7 @@ dissect_rpc_indir_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
rpc_call->flavor = FLAVOR_NOT_GSSAPI;
rpc_call->gss_proc = 0;
rpc_call->gss_svc = 0;
rpc_call->proc_info = value;
rpc_call->proc_info = (rpc_proc_info_value*)wmem_memdup(wmem_file_scope(), value, sizeof(*value));
/* store it */
wmem_tree_insert32(rpc_conv_info->xids, xid, (void *)rpc_call);
}
@ -2040,18 +2040,10 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
/* in parse-partials, so define a dummy conversation for this reply */
rpc_call = wmem_new(wmem_file_scope(), rpc_call_info_value);
rpc_call->req_num = 0;
rpc_call = wmem_new0(wmem_file_scope(), rpc_call_info_value);
rpc_call->rep_num = pinfo->fd->num;
rpc_call->prog = 0;
rpc_call->vers = 0;
rpc_call->proc = 0;
rpc_call->private_data = NULL;
rpc_call->xid = xid;
rpc_call->flavor = FLAVOR_NOT_GSSAPI; /* total punt */
rpc_call->gss_proc = 0;
rpc_call->gss_svc = 0;
rpc_call->proc_info = value;
rpc_call->req_time = pinfo->fd->abs_ts;
/* store it */
@ -2342,7 +2334,7 @@ dissect_rpc_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
rpc_call->flavor = flavor;
rpc_call->gss_proc = gss_proc;
rpc_call->gss_svc = gss_svc;
rpc_call->proc_info = value;
rpc_call->proc_info = (rpc_proc_info_value*)wmem_memdup(wmem_file_scope(), value, sizeof(*value));
rpc_call->req_time = pinfo->fd->abs_ts;
/* store it */