Add fixes for CVE-2008-1614
[manu/suphp.git] / src / File.cpp
index 6c6d303..b0b20c2 100644 (file)
@@ -57,6 +57,9 @@ std::string suPHP::File::getRealPath() const throw (SystemException) {
 File suPHP::File::getParentDirectory() const {
     std::string path = this->getPath();
     path = path.substr(0, path.rfind('/'));
+    if (path.length() == 0) {
+        path = "/";
+    }
     return File(path);
 }
 
@@ -104,3 +107,7 @@ UserInfo suPHP::File::getUser() const throw (SystemException) {
 GroupInfo suPHP::File::getGroup() const throw (SystemException) {
     return API_Helper::getSystemAPI().File_getGroup(*this);
 }
+
+bool suPHP::File::isSymlink() const throw (SystemException) {
+    return API_Helper::getSystemAPI().File_isSymlink(*this);
+}