- curNode = VFS_ParsePath(tmp, TruePath);
- if(TruePath)
- LOG("VFS", "*TruePath='%s'", *TruePath);
-
- // Error Check
- if(!curNode) {
- Log_Debug("VFS", "Symlink fail '%s'", tmp);
- free(tmp); // Free temp string
- if(TruePath) free(TruePath);
- LEAVE('n');
- return NULL;
+ // - Just update the path variable and restart the function
+ // > Count nested symlinks and limit to some value (counteracts loops)
+ {
+ int remlen = strlen(Path) - (ofs + nextSlash);
+ if( curNode->Size + remlen > MAX_PATH_LEN ) {
+ if(curNode->Close) curNode->Close(curNode);
+ Log_Warning("VFS", "VFS_ParsePath - Symlinked path too long");
+ LEAVE('n');
+ return NULL;
+ }
+ curNode->Read( curNode, 0, curNode->Size, path_buffer );
+ path_buffer[ curNode->Size ] = '\0';
+ strcat(path_buffer, &Path[ofs+nextSlash]);
+
+ Path = path_buffer;
+ iNestedLinks ++;