summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schuh <andreas.schuh.84@gmail.com>2017-07-11 09:45:17 +0100
committerAndreas Schuh <andreas.schuh.84@gmail.com>2017-07-11 14:47:40 +0100
commit74603f5ed3bb99d699b0c5cf091d870f22ea255b (patch)
tree336b671ecd02ad52d9711e5c6bcf6c87be8c5f8c
parent4a694e87361d08eff5c4c9e9f551b1a0d41f7c40 (diff)
downloadgflags-74603f5ed3bb99d699b0c5cf091d870f22ea255b.tar.gz
gflags-74603f5ed3bb99d699b0c5cf091d870f22ea255b.tar.bz2
gflags-74603f5ed3bb99d699b0c5cf091d870f22ea255b.zip
fix: Static code analyzer error regarding strncmp with empty kRootDir string
-rw-r--r--src/gflags.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gflags.cc b/src/gflags.cc
index 08e4f45..f270798 100644
--- a/src/gflags.cc
+++ b/src/gflags.cc
@@ -591,7 +591,7 @@ const char* CommandLineFlag::CleanFileName() const {
const char* clean_name = filename() + strlen(filename()) - 1;
while ( clean_name > filename() ) {
if (*clean_name == PATH_SEPARATOR) {
- if (strncmp(clean_name, kRootDir, sizeof(kRootDir)-1) == 0) {
+ if (sizeof(kRootDir) > 1 && strncmp(clean_name, kRootDir, sizeof(kRootDir)-1) == 0) {
clean_name += sizeof(kRootDir)-1; // past root-dir
break;
}