]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Workaround several Coverity scan false positives
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 8 Jan 2015 23:27:17 +0000 (15:27 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 8 Jan 2015 23:27:17 +0000 (15:27 -0800)
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().

src/carp.cc
src/servers/FtpServer.cc

index 9bee8504e2306071d253ab3861407ba8148a33f3..d8a34bd83d5fe76ff079f93199f42771cf98f174 100644 (file)
@@ -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;
index 3bc3122cd876bb375ed4f3189088fd43e8ac35ed..5bc7912e144578d2d5698360acdfafa3ef4d5b8b 100644 (file)
@@ -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("/", "/");