From 60ecf03c6d710c79173b83c6afbbfc21bda68e64 Mon Sep 17 00:00:00 2001 From: Prabhjot Singh Sethi Date: Tue, 23 Feb 2016 19:47:30 +0530 Subject: [PATCH] Fix handling empty url string for Health Check 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:://" Change-Id: Iba608d01fa89656a7b902ca4781331ca60ac9789 Closes-Bug:1548702 --- src/vnsw/agent/oper/health_check.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vnsw/agent/oper/health_check.cc b/src/vnsw/agent/oper/health_check.cc index 278851be331..1275640e40c 100644 --- a/src/vnsw/agent/oper/health_check.cc +++ b/src/vnsw/agent/oper/health_check.cc @@ -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);