nfs4: Correctly parse paths with '.' or '..'
This commit is contained in:
parent
a0d5a922d6
commit
07b3bd59ab
@ -13,8 +13,6 @@
|
|||||||
#include "Request.h"
|
#include "Request.h"
|
||||||
|
|
||||||
|
|
||||||
// TODO: This function probably needs more strict checking against incorrect
|
|
||||||
// paths. Correct handling of '..' and '.' also may be useful.
|
|
||||||
status_t
|
status_t
|
||||||
FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path)
|
FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path)
|
||||||
{
|
{
|
||||||
@ -33,8 +31,13 @@ FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path)
|
|||||||
*pathEnd = '\0';
|
*pathEnd = '\0';
|
||||||
|
|
||||||
if (pathEnd != pathStart) {
|
if (pathEnd != pathStart) {
|
||||||
req.LookUp(pathStart);
|
if (!strcmp(pathStart, "..")) {
|
||||||
count++;
|
req.LookUpUp();
|
||||||
|
count++;
|
||||||
|
} else if (strcmp(pathStart, ".")) {
|
||||||
|
req.LookUp(pathStart);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pathEnd != NULL && pathEnd[1] != '\0')
|
if (pathEnd != NULL && pathEnd[1] != '\0')
|
||||||
|
Loading…
Reference in New Issue
Block a user