Fixed scan depth check

This commit is contained in:
Uwe Seimet 2021-12-20 22:45:24 +01:00
parent 87e8b3be6a
commit 6c98228726
1 changed files with 8 additions and 8 deletions

View File

@ -251,6 +251,10 @@ bool RascsiImage::RenameImage(int fd, const PbCommand& command)
return ReturnStatus(fd, false, "Can't rename image file: Missing source filename");
}
if (!CheckDepth(from)) {
return ReturnStatus(fd, false, ("Invalid folder hierarchy depth '" + from + "'").c_str());
}
from = default_image_folder + "/" + from;
if (!IsValidSrcFilename(from)) {
return ReturnStatus(fd, false, "Can't rename image file: '" + from + "': Invalid name or type");
@ -261,10 +265,6 @@ bool RascsiImage::RenameImage(int fd, const PbCommand& command)
return ReturnStatus(fd, false, "Can't rename image file '" + from + "': Missing destination filename");
}
if (!CheckDepth(from)) {
return ReturnStatus(fd, false, ("Invalid folder hierarchy depth '" + from + "'").c_str());
}
if (!CheckDepth(to)) {
return ReturnStatus(fd, false, ("Invalid folder hierarchy depth '" + to + "'").c_str());
}
@ -294,6 +294,10 @@ bool RascsiImage::CopyImage(int fd, const PbCommand& command)
return ReturnStatus(fd, false, "Can't copy image file: Missing source filename");
}
if (!CheckDepth(from)) {
return ReturnStatus(fd, false, ("Invalid folder hierarchy depth '" + from + "'").c_str());
}
from = default_image_folder + "/" + from;
if (!IsValidSrcFilename(from)) {
return ReturnStatus(fd, false, "Can't copy image file: '" + from + "': Invalid name or type");
@ -304,10 +308,6 @@ bool RascsiImage::CopyImage(int fd, const PbCommand& command)
return ReturnStatus(fd, false, "Can't copy image file '" + from + "': Missing destination filename");
}
if (!CheckDepth(from)) {
return ReturnStatus(fd, false, ("Invalid folder hierarchy depth '" + from + "'").c_str());
}
if (!CheckDepth(to)) {
return ReturnStatus(fd, false, ("Invalid folder hierarchy depth '" + to + "'").c_str());
}