From: Amos Jeffries Date: Thu, 8 Jan 2015 23:27:17 +0000 (-0800) Subject: Workaround several Coverity scan false positives X-Git-Tag: merge-candidate-3-v1~361 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ab4c5a361ad214d4ccdda55bde34b587f5a33ce7;p=thirdparty%2Fsquid.git Workaround several Coverity scan false positives Coverity gets confused by SBuf::npos value used as implicit append() length parameter for special case when SBuf is required to call strlen() Remove some unnecesary uses of that overloaded form of append(). --- diff --git a/src/carp.cc b/src/carp.cc index 9bee8504e2..d8a34bd83d 100644 --- a/src/carp.cc +++ b/src/carp.cc @@ -175,9 +175,7 @@ carpSelectParent(HttpRequest * request) key.append(request->GetHost()); } if (tp->options.carp_key.port) { - static char portbuf[7]; - snprintf(portbuf,7,":%d", request->port); - key.append(portbuf); + key.appendf(":%d", request->port); } if (tp->options.carp_key.path) { String::size_type pos; diff --git a/src/servers/FtpServer.cc b/src/servers/FtpServer.cc index 3bc3122cd8..5bc7912e14 100644 --- a/src/servers/FtpServer.cc +++ b/src/servers/FtpServer.cc @@ -331,12 +331,12 @@ Ftp::Server::calcUri(const SBuf *file) uri.append(host); if (port->ftp_track_dirs && master->workingDir.length()) { if (master->workingDir[0] != '/') - uri.append("/"); + uri.append("/", 1); uri.append(master->workingDir); } if (uri[uri.length() - 1] != '/') - uri.append("/"); + uri.append("/", 1); if (port->ftp_track_dirs && file) { static const CharacterSet Slash("/", "/");