Repository: trafficserver Updated Branches: refs/heads/6.0.x 616bfe5c9 -> 55cf073b5
TS-3887: Use snprintf() instead of sprintf() in UrlPrintHack (cherry picked from commit 98ab90758e3f28a71beb011afb3e83260e77289d) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f547a472 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f547a472 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f547a472 Branch: refs/heads/6.0.x Commit: f547a472b1360b08c9979923eba01080f9460d4f Parents: 616bfe5 Author: Masa Sekimura <[email protected]> Authored: Wed Sep 2 21:02:14 2015 -0600 Committer: Bryan Call <[email protected]> Committed: Thu Sep 3 09:37:08 2015 -0700 ---------------------------------------------------------------------- proxy/hdrs/HTTP.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f547a472/proxy/hdrs/HTTP.cc ---------------------------------------------------------------------- diff --git a/proxy/hdrs/HTTP.cc b/proxy/hdrs/HTTP.cc index 3a3d067..aa0040b 100644 --- a/proxy/hdrs/HTTP.cc +++ b/proxy/hdrs/HTTP.cc @@ -1607,7 +1607,7 @@ class UrlPrintHack if (0 == hdr->m_url_cached.port_get_raw() && hdr->m_port_in_header) { ink_assert(0 == ui->m_ptr_port); // shouldn't be set if not in URL. ui->m_ptr_port = m_port_buff; - ui->m_len_port = sprintf(m_port_buff, "%.5d", hdr->m_port); + ui->m_len_port = snprintf(m_port_buff, sizeof(m_port_buff), "%d", hdr->m_port); m_port_modified_p = true; } else { m_port_modified_p = false; @@ -1653,7 +1653,7 @@ class UrlPrintHack HTTPHdr *m_hdr; ///@} /// Temporary buffer for port data. - char m_port_buff[6]; + char m_port_buff[32]; }; char *
