Repository: trafficserver Updated Branches: refs/heads/master 1cbed93f4 -> eaf53d5e8
[TS-3294]: Add null pointer check after strtok_r Coverity CID#1238928 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/eaf53d5e Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/eaf53d5e Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/eaf53d5e Branch: refs/heads/master Commit: eaf53d5e81d065c89ad2a282834b07a675e9b4ab Parents: 1cbed93 Author: Sudheer Vinukonda <sudhe...@yahoo-inc.com> Authored: Thu Jan 15 00:26:16 2015 +0000 Committer: Sudheer Vinukonda <sudhe...@yahoo-inc.com> Committed: Thu Jan 15 00:26:16 2015 +0000 ---------------------------------------------------------------------- proxy/http/HttpSM.cc | 4 ++++ 1 file changed, 4 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eaf53d5e/proxy/http/HttpSM.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index ee42ed4..99da799 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -7660,6 +7660,9 @@ HttpSM::redirect_request(const char *redirect_url, const int redirect_len) // the client request didn't have a host, so use the current origin host DebugSM("http_redirect", "[HttpSM::redirect_request] keeping client request host %s://%s", next_hop_scheme, origHost); char* origHost1 = strtok_r(origHost, ":", &saveptr); + if (origHost1 == NULL) { + goto LhostError; + } origHost_len = strlen(origHost1); int origHostPort_len = origHost_len; char buf[origHostPort_len + 7]; @@ -7691,6 +7694,7 @@ HttpSM::redirect_request(const char *redirect_url, const int redirect_len) t_state.hdr_info.client_request.m_target_cached = false; clientUrl.scheme_set(scheme_str, scheme_len); } else { +LhostError: // the server request didn't have a host, so remove it from the headers t_state.hdr_info.client_request.field_delete(MIME_FIELD_HOST, MIME_LEN_HOST); }