summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-07-01 23:48:29 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-07-01 21:55:16 +0000
commit4a8f0e16f5b0a3ee04c4a6c35348884174f9f049 (patch)
treef64a7617d776cbe5acfd649a6c0457da3279ccff
parentc445570c49a9ecfb5d59f606a6307b441e082d92 (diff)
downloadwireshark-4a8f0e16f5b0a3ee04c4a6c35348884174f9f049.tar.gz
PMPROXY: avoid doing an invalid memory access when no token was found
Bug: 11320 Change-Id: Ie1fd3f1060e13cf742923aadebe375da4389422a Reviewed-on: https://code.wireshark.org/review/9447 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r--epan/dissectors/packet-pmproxy.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/packet-pmproxy.c b/epan/dissectors/packet-pmproxy.c
index 718d32546c..bbc5caa8df 100644
--- a/epan/dissectors/packet-pmproxy.c
+++ b/epan/dissectors/packet-pmproxy.c
@@ -89,14 +89,15 @@ static int dissect_proxy_to_host(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
host_and_port = wmem_strsplit(wmem_packet_scope(), pmproxy_host_and_port_string, " ", -1);
if(host_and_port != NULL) {
host = host_and_port[0];
- port = host_and_port[1];
if (host) {
proto_tree_add_string(tree, hf_pmproxy_host, tvb, offset, (guint32)strlen(host), host);
- offset += (int)strlen(host);
- }
- offset += PMPROXY_HOST_AND_PORT_DELIMETER_LENGTH;
- if (port) {
- proto_tree_add_string(tree, hf_pmproxy_port, tvb, offset, (guint32)strlen(port), port);
+ offset += (int)strlen(host) + PMPROXY_HOST_AND_PORT_DELIMETER_LENGTH;
+ port = host_and_port[1];
+ if (port) {
+ proto_tree_add_string(tree, hf_pmproxy_port, tvb, offset, (guint32)strlen(port), port);
+ }
+ } else {
+ port = NULL;
}
col_append_fstr(pinfo->cinfo, COL_INFO, " Host=%s, Port=%s", host ? host : "", port ? port : "");
}