nfs4: Correctly parse paths with '.' or '..'

This commit is contained in:
Pawel Dziepak 2013-02-12 23:05:32 +01:00
parent a0d5a922d6
commit 07b3bd59ab

View File

@ -13,8 +13,6 @@
#include "Request.h"
// TODO: This function probably needs more strict checking against incorrect
// paths. Correct handling of '..' and '.' also may be useful.
status_t
FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path)
{
@ -33,8 +31,13 @@ FileInfo::ParsePath(RequestBuilder& req, uint32& count, const char* _path)
*pathEnd = '\0';
if (pathEnd != pathStart) {
req.LookUp(pathStart);
count++;
if (!strcmp(pathStart, "..")) {
req.LookUpUp();
count++;
} else if (strcmp(pathStart, ".")) {
req.LookUp(pathStart);
count++;
}
}
if (pathEnd != NULL && pathEnd[1] != '\0')