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>
This commit is contained in:
Pascal Quantin 2015-07-01 23:48:29 +02:00
parent c445570c49
commit 4a8f0e16f5
1 changed files with 7 additions and 6 deletions

View File

@ -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 : "");
}