]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsbulktest: Explicitely check that find() returned 0
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 29 May 2019 09:35:35 +0000 (11:35 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 29 May 2019 09:35:35 +0000 (11:35 +0200)
std::string::find() will return 0 if the line starts with '.', but
it was not obvious from the existing code whether we tested for 0
or a string::npos since we treated the return value as a boolean.
Reported by Coverity (CID 1401631).

pdns/dnsbulktest.cc

index 27a288173be8e29c02576c3c2b853d09eaef1d91..c2f21ba92b4e6fa2e801d29ba23fb97c9195dd9f 100644 (file)
@@ -293,7 +293,7 @@ try
     split=splitField(line,',');
     if (split.second.empty())
       split=splitField(line,'\t');
-    if(!split.second.find('.')) // skip 'Hidden profile' in quantcast list.
+    if(split.second.find('.') == 0) // skip 'Hidden profile' in quantcast list.
       continue;
     pos=split.second.find('/');
     if(pos != string::npos) // alexa has whole urls in the list now.