Explorar el Código

HPCC-15428 CLocalEnvironment doesn't check properly the drop zone path in
getDropZoneByAddressPath() function.

Add path separator character at the end of the drop zone path (if there
is not any) before compare it to the target file path.

Signed-off-by: Attila Vamos <attila.vamos@gmail.com>

Attila Vamos hace 9 años
padre
commit
a24674333a
Se han modificado 1 ficheros con 5 adiciones y 4 borrados
  1. 5 4
      common/environment/environment.cpp

+ 5 - 4
common/environment/environment.cpp

@@ -1576,12 +1576,13 @@ IConstDropZoneInfo * CLocalEnvironment::getDropZoneByAddressPath(const char * ne
 
     ForEach(*zoneIt)
     {
-        SCMStringBuffer dropZoneName;
-        zoneIt->query().getName(dropZoneName);
-
         SCMStringBuffer dropZoneDir;
         zoneIt->query().getDirectory(dropZoneDir);
-        const char * pdropzoneDir = dropZoneDir.str();
+        StringBuffer fullDropZoneDir(dropZoneDir.str());
+        const char pathSeparator = fullDropZoneDir.charAt(0);
+        if (fullDropZoneDir.charAt(fullDropZoneDir.length()) != pathSeparator)
+            fullDropZoneDir.append(pathSeparator);
+        const char * pdropzoneDir = fullDropZoneDir.str();
 
         // Check target file path starts with this Drop zone path
         // the drop zone paths can be nested (nothing forbids it) like