]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/configuration.cc
fix "(error) Possible null pointer dereference: BindAddr" by ensuring
[apt.git] / apt-pkg / contrib / configuration.cc
index 0f7b37ee9964d0592b09806da07fdf50a44fc5d3..36866a35ad2a85e846809f716faccf2d7c5b98b7 100644 (file)
@@ -185,8 +185,14 @@ string Configuration::FindFile(const char *Name,const char *Default) const
    }
    
    string val = Itm->Value;
-   while (Itm->Parent != 0 && Itm->Parent->Value.empty() == false)
-   {    
+   while (Itm->Parent != 0)
+   {
+      if (Itm->Parent->Value.empty() == true)
+      {
+        Itm = Itm->Parent;
+        continue;
+      }
+
       // Absolute
       if (val.length() >= 1 && val[0] == '/')
          break;
@@ -873,10 +879,10 @@ Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config)
       {
         regfree(p);
         delete p;
-        clearPatterns();
-        _error->Warning("Regex compilation error for '%s' in configuration option '%s'",
-                               s->c_str(), Config);
-        return;
+        _error->Warning("Invalid regular expression '%s' in configuration "
+                         "option '%s' will be ignored.",
+                         s->c_str(), Config);
+        continue;
       }
    }
    if (strings.size() == 0)
@@ -897,6 +903,7 @@ void Configuration::MatchAgainstConfig::clearPatterns()
       regfree(*p);
       delete *p;
    }
+   patterns.clear();
 }
                                                                        /*}}}*/
 // MatchAgainstConfig::Match - returns true if a pattern matches       /*{{{*/