]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added more checks
authorArvin Schnell <aschnell@suse.de>
Tue, 10 May 2011 10:02:58 +0000 (12:02 +0200)
committerArvin Schnell <aschnell@suse.de>
Tue, 10 May 2011 10:02:58 +0000 (12:02 +0200)
snapper/Snapper.cc

index a64fb0a9f846a3e694607b2b15ac3ddea9d3378f..07b283abff86a66ce7075bb8e66d3b79e416a4cf 100644 (file)
@@ -24,6 +24,7 @@
 #include <sys/types.h>
 #include <glob.h>
 #include <string.h>
+#include <boost/algorithm/string.hpp>
 
 #include "config.h"
 #include "snapper/Snapper.h"
@@ -543,6 +544,16 @@ namespace snapper
        y2mil("config_name:" << config_name << " subvolume:" << subvolume <<
              " template_name:" << template_name);
 
+       if (config_name.empty() || config_name.find_first_of(" \t") != string::npos)
+       {
+           throw AddConfigFailedException("illegal config");
+       }
+
+       if (!boost::starts_with(subvolume, "/"))
+       {
+           throw AddConfigFailedException("illegal subvolume");
+       }
+
        if (access(string(CONFIGTEMPLATEDIR "/" + template_name).c_str(), R_OK) != 0)
        {
            throw AddConfigFailedException("cannot access template config");