PMPROXY: check that pointer is not NULL before doing a strlen

Bug: 11258
Change-Id: I5c8c17861f79d0b0cc5286fca742ed16e8d4ba74
Reviewed-on: https://code.wireshark.org/review/8840
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2015-06-08 16:09:29 +02:00
parent a36ec5a0bb
commit b30d7b1f77
1 changed files with 9 additions and 4 deletions

View File

@ -90,10 +90,15 @@ static int dissect_proxy_to_host(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
if(host_and_port != NULL) {
host = host_and_port[0];
port = host_and_port[1];
proto_tree_add_string(tree, hf_pmproxy_host, tvb, offset, (guint32)strlen(host), host);
offset += (int)strlen(host) + PMPROXY_HOST_AND_PORT_DELIMETER_LENGTH;
proto_tree_add_string(tree, hf_pmproxy_port, tvb, offset, (guint32)strlen(port), port);
col_append_fstr(pinfo->cinfo, COL_INFO, " Host=%s, Port=%s", host, port);
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);
}
col_append_fstr(pinfo->cinfo, COL_INFO, " Host=%s, Port=%s", host ? host : "", port ? port : "");
}
}
return proxy_to_length;