Index: /trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp	(revision 57614)
+++ /trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp	(revision 57615)
@@ -203,5 +203,5 @@
         RTDIRENTRY      DirEntry;
         /** Padding the buffer to an unreasonably large size. */
-        uint8_t         abPadding[RTPATH_MAX + RT_OFFSETOF(RTDIRENTRY, szName)];
+        uint8_t         abPadding[RTPATH_MAX + sizeof(RTDIRENTRY)];
     } u;
 
@@ -443,5 +443,13 @@
     {
         char *pchSep = strchr(pszPath, chSep);
-        if (iItem > 0)
+
+        /* We ignore empty strings, which is probably not entirely correct,
+           but works better on DOS based system with many entries added
+           without checking whether there is a trailing separator or not.
+           Thus, the current directory is only searched if a '.' is present
+           in the PATH. */
+        if (pchSep == pszPath)
+            pszPath++;
+        else if (iItem > 0)
         {
             /* If we didn't find a separator, the item doesn't exists. Quit. */
@@ -449,20 +457,11 @@
                 break;
 
-            /* We ignore empty strings, which is probably not entirely correct,
-               but works better on DOS based system with many entries added
-               without checking whether there is a trailing separator or not.
-               Thus, the current directory is only searched if a '.' is present
-               in the PATH. */
-            if (pchSep != pszPath)
-            {
-                pszPath = pchSep;
-                iItem--;
-            }
-            pszPath++;
+            pszPath = pchSep + 1;
+            iItem--;
         }
         else
         {
             /* We've reached the item we wanted. */
-            size_t cchComp = pchSep ? pszPath - pchSep : strlen(pszPath);
+            size_t cchComp = pchSep ? pchSep - pszPath : strlen(pszPath);
             if (cchComp < cbBuf)
             {
@@ -474,4 +473,5 @@
             else
                 rc = VERR_BUFFER_OVERFLOW;
+            *pcchValue = cchComp;
             break;
         }
@@ -1072,10 +1072,10 @@
                 if (cchPattern == 0)
                 {
-                    pInstr->enmOpCode = iFirst + 1 == pAllocator->iNext
+                    pInstr->enmOpCode = iFirst + 1U == pAllocator->iNext
                                       ? RTPATHMATCHOP_RETURN_MATCH_EXCEPT_DOT_AND_DOTDOT : RTPATHMATCHOP_RETURN_MATCH;
                     break;
                 }
 
-                pInstr->enmOpCode = iFirst + 1 == pAllocator->iNext
+                pInstr->enmOpCode = iFirst + 1U == pAllocator->iNext
                                   ? RTPATHMATCHOP_ZERO_OR_MORE_EXCEPT_DOT_AND_DOTDOT : RTPATHMATCHOP_ZERO_OR_MORE;
                 pInstr->uOp2      = (uint16_t)offInput;
@@ -1225,5 +1225,5 @@
                         pchPattern += cchVarNm + 1;
                         cchPattern -= cchVarNm + 1;
-                        AssertMsgReturn(!g_aVariables[iVar].fFirstOnly || iFirst + 1 == pAllocator->iNext,
+                        AssertMsgReturn(!g_aVariables[iVar].fFirstOnly || iFirst + 1U == pAllocator->iNext,
                                         ("Glob variable '%s' should be first\n", g_aVariables[iVar].pszName),
                                         VERR_PATH_MATCH_VARIABLE_MUST_BE_FIRST);
@@ -1245,5 +1245,5 @@
         while (cchPlain < cchPattern)
         {
-            char const ch = pchPattern[cchPlain];
+            ch = pchPattern[cchPlain];
             if (!ASMBitTest(s_bmMetaChars, (uint8_t)ch))
             { /* probable */ }
