Skip to content

Commit

Permalink
Fix handling empty url string for Health Check
Browse files Browse the repository at this point in the history
Issue:
------
when url string is empty http parser does not seems to
return error and urldata being uninitialised cause
invalid length access in string.

Fix:
----
skip url parsing if url path is empty, this will allow
health check to fallback default to
"http:://<vmi-instance-ip>"

Closes-Bug:1548702
Change-Id: Iba608d01fa89656a7b902ca4781331ca60ac9789
(cherry picked from commit 60ecf03)
  • Loading branch information
Prabhjot Singh Sethi committed Feb 23, 2016
1 parent db85f8a commit dc9c5e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vnsw/agent/oper/health_check.cc
Expand Up @@ -430,7 +430,8 @@ static HealthCheckServiceData *BuildData(Agent *agent, IFMapNode *node,
boost::system::error_code ec;
dest_ip = Ip4Address::from_string(p.url_path, ec);
url_path = p.url_path;
} else {
} else if (!p.url_path.empty()) {
// parse url if available
struct http_parser_url urldata;
int ret = http_parser_parse_url(p.url_path.c_str(), p.url_path.size(),
false, &urldata);
Expand Down

0 comments on commit dc9c5e9

Please sign in to comment.