aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-http.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-11-22 20:47:59 -0500
committerAnders Broman <a.broman58@gmail.com>2014-11-25 15:18:05 +0000
commite3a04bb392824781b8a3ef6ec98a37ef96c6c827 (patch)
treec51c48f12e302c76bc2c1619d24b9787384db261 /epan/dissectors/packet-http.c
parent7f22ce7f6610333f4b40dfad6cde22e352abae6f (diff)
Ensure dissector data parameter is used instead of pinfo->private_data when passing data between dissectors using the "media_type" subdissector.
Change-Id: I82cbfed770b41404bc42cb6a4413db07d04dffdc Reviewed-on: https://code.wireshark.org/review/5462 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-http.c')
-rw-r--r--epan/dissectors/packet-http.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index 64c27e8a07..b535d9cb8c 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -1267,8 +1267,6 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
* There's stuff left over; process it.
*/
tvbuff_t *next_tvb;
- void *save_private_data = NULL;
- gboolean private_data_changed = FALSE;
gint chunks_decoded = 0;
char *media_str = NULL;
@@ -1434,15 +1432,9 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
* Content-Type value. Is there any subdissector
* for that content type?
*/
- save_private_data = pinfo->private_data;
- private_data_changed = TRUE;
+ if (headers.content_type_parameters)
+ media_str = wmem_strdup(wmem_packet_scope(), headers.content_type_parameters);
- if (headers.content_type_parameters) {
- pinfo->private_data = wmem_strdup(wmem_packet_scope(), headers.content_type_parameters);
- media_str = (char*)pinfo->private_data;
- }
- else
- pinfo->private_data = NULL;
/*
* Calling the string handle for the media type
* dissector table will set pinfo->match_string
@@ -1477,7 +1469,7 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
/*
* We have a subdissector - call it.
*/
- dissected = call_dissector_only(handle, next_tvb, pinfo, tree, NULL);
+ dissected = call_dissector_only(handle, next_tvb, pinfo, tree, media_str);
if (!dissected)
expert_add_info(pinfo, http_tree, &ei_http_subdissector_failed);
}
@@ -1514,12 +1506,6 @@ dissect_http_message(tvbuff_t *tvb, int offset, packet_info *pinfo,
body_dissected:
/*
- * Do *not* attempt at freeing the private data;
- * it may be in use by subdissectors.
- */
- if (private_data_changed) /*restore even NULL value*/
- pinfo->private_data = save_private_data;
- /*
* We've processed "datalen" bytes worth of data
* (which may be no data at all); advance the
* offset past whatever data we've processed.