Changeset 93071 in vbox for trunk/src/VBox/Additions/os2/VBoxSF
- Timestamp:
- Dec 24, 2021 12:12:04 AM (3 years ago)
- Location:
- trunk/src/VBox/Additions/os2/VBoxSF
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSF.cpp
r79112 r93071 1964 1964 * @param pEaOp Kernel copy of the EA request with flattened pointers. 1965 1965 * @param uLevel The info level being queried. 1966 * @param cbFullEasLeft The size of the full EA buffer, ~(ULONG)0 if it 1967 * should be read in from pEaOp->fpFEAList->cbList. 1966 1968 * @param pcbWritten Where to return the length of the resulting list. Optional. 1967 1969 * @param poffError User buffer address of EAOP.oError for reporting GEALIST issues. 1968 1970 */ 1969 APIRET vboxSfOs2MakeEmptyEaListEx(PEAOP pEaOp, ULONG uLevel, uint32_t *pcbWritten, ULONG *poffError)1971 APIRET vboxSfOs2MakeEmptyEaListEx(PEAOP pEaOp, ULONG uLevel, ULONG cbFullEasLeft, uint32_t *pcbWritten, ULONG *poffError) 1970 1972 { 1971 1973 ULONG cbDstList; … … 1990 1992 ULONG cbGetEasLeft = 0; 1991 1993 rc = KernCopyIn(&cbGetEasLeft, &pEaOp->fpGEAList->cbList, sizeof(pEaOp->fpGEAList->cbList)); 1992 ULONG cbFullEasLeft = 0; 1993 if (rc == NO_ERROR) 1994 if (rc == NO_ERROR && cbFullEasLeft == ~(ULONG)0) 1994 1995 rc = KernCopyIn(&cbFullEasLeft, &pEaOp->fpFEAList->cbList, sizeof(cbFullEasLeft)); 1995 1996 if ( rc == NO_ERROR … … 2013 2014 * pbSrc: GEA: BYTE cbName; char szName[]; 2014 2015 */ 2015 /* Get name length. */ 2016 uint8_t cbName = 0; 2017 rc = KernCopyIn(&cbName, pbSrc, sizeof(cbName)); 2018 Log3(("vboxSfOs2MakeEmptyEaList: cbName=%#x rc=%u\n", cbName, rc)); 2016 /* Get name length (we call it cchName instead of cbName since 2017 it does not include the zero terminator). */ 2018 uint8_t cchName = 0; 2019 rc = KernCopyIn(&cchName, pbSrc, sizeof(cchName)); 2020 Log3(("vboxSfOs2MakeEmptyEaList: cchName=%#x rc=%u\n", cchName, rc)); 2019 2021 if (rc != NO_ERROR) 2020 2022 break; 2021 2023 pbSrc++; 2022 2024 cbGetEasLeft--; 2023 if (c bName + 1U > cbGetEasLeft)2025 if (cchName + 1U > cbGetEasLeft) 2024 2026 { 2025 2027 cbDstList = pbSrc - 1 - (uint8_t *)pEaOp->fpGEAList; … … 2032 2034 2033 2035 /* Copy in name. */ 2034 rc = KernCopyIn(pszNameBuf, pbSrc, c bName + 1);2036 rc = KernCopyIn(pszNameBuf, pbSrc, cchName + 1); 2035 2037 if (rc != NO_ERROR) 2036 2038 break; 2037 Log3(("vboxSfOs2MakeEmptyEaList: szName: %.*Rhxs\n", c bName + 1, pszNameBuf));2038 if ((char *)memchr(pszNameBuf, '\0', c bName) != &pszNameBuf[cbName])2039 Log3(("vboxSfOs2MakeEmptyEaList: szName: %.*Rhxs\n", cchName + 1, pszNameBuf)); 2040 if ((char *)memchr(pszNameBuf, '\0', cchName + 1) != &pszNameBuf[cchName]) 2039 2041 { 2040 2042 cbDstList = pbSrc - 1 - (uint8_t *)pEaOp->fpGEAList; … … 2047 2049 2048 2050 /* Skip input. */ 2049 cbGetEasLeft -= c bName + 1;2050 pbSrc += c bName + 1;2051 cbGetEasLeft -= cchName + 1; 2052 pbSrc += cchName + 1; 2051 2053 2052 2054 /* … … 2054 2056 * Note! We should technically skip duplicates here, but who cares... 2055 2057 */ 2056 if (c bName > 0)2058 if (cchName > 0) 2057 2059 { 2058 2060 FEA Result; 2059 if (sizeof(Result) + cbName + 1 > cbFullEasLeft) 2061 if (sizeof(Result) + cchName + 1 <= cbFullEasLeft) 2062 cbFullEasLeft -= sizeof(Result) + cchName + 1; 2063 else 2060 2064 { 2061 Log(("vboxSfOs2MakeEmptyEaList: ERROR_BUFFER_OVERFLOW (%#x vs %#x)\n", sizeof(Result) + c bName + 1, cbFullEasLeft));2065 Log(("vboxSfOs2MakeEmptyEaList: ERROR_BUFFER_OVERFLOW (%#x vs %#x)\n", sizeof(Result) + cchName + 1, cbFullEasLeft)); 2062 2066 rc = ERROR_BUFFER_OVERFLOW; 2063 2067 break; 2064 2068 } 2065 cbFullEasLeft -= sizeof(Result) + cbName + 1;2066 2069 2067 2070 Result.fEA = 0; 2068 Result.cbName = c bName;2071 Result.cbName = cchName; 2069 2072 Result.cbValue = 0; 2070 2073 rc = KernCopyOut(pbDst, &Result, sizeof(Result)); … … 2073 2076 pbDst += sizeof(Result); 2074 2077 2075 rc = KernCopyOut(pbDst, pszNameBuf, c bName + 1);2078 rc = KernCopyOut(pbDst, pszNameBuf, cchName + 1); 2076 2079 if (rc != NO_ERROR) 2077 2080 break; 2078 pbDst += c bName + 1;2081 pbDst += cchName + 1; 2079 2082 } 2080 2083 } /* (while more GEAs) */ … … 2135 2138 Log2(("vboxSfOs2MakeEmptyEaList: #0b: %p %p\n", EaOp.fpGEAList, EaOp.fpFEAList)); 2136 2139 2137 rc = vboxSfOs2MakeEmptyEaListEx(&EaOp, uLevel, NULL, &pEaOp->oError);2140 rc = vboxSfOs2MakeEmptyEaListEx(&EaOp, uLevel, ~(ULONG)0, NULL, &pEaOp->oError); 2138 2141 } 2139 2142 return rc; -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFFind.cpp
r84484 r93071 344 344 pbDst = pbToCopy; 345 345 346 /* Output empty EA list. We don't try anticipate filename output length here, 347 instead we'll just handle that when we come to it below. */ 348 /** @todo If this overflows, JFS will return ERROR_EAS_DIDNT_FIT and just the 349 * EA size here (i.e. as if FI_LVL_STANDARD_EASIZE or _64 was requested). 350 * I think, however, that ERROR_EAS_DIDNT_FIT should only be considered if 351 * this is the first entry we're returning and we'll have to stop after it. */ 346 352 uint32_t cbWritten = 0; 347 353 EaOp.fpFEAList = (PFEALIST)pbData; 348 rc = vboxSfOs2MakeEmptyEaListEx(&EaOp, uLevel, &cbWritten, &pEaOpUser->oError);354 rc = vboxSfOs2MakeEmptyEaListEx(&EaOp, uLevel, cbData, &cbWritten, &pEaOpUser->oError); 349 355 if (rc == NO_ERROR) 350 356 { -
trunk/src/VBox/Additions/os2/VBoxSF/VBoxSFInternal.h
r84509 r93071 249 249 APIRET vboxSfOs2CheckEaOpForCreation(EAOP const *pEaOp); 250 250 APIRET vboxSfOs2MakeEmptyEaList(PEAOP pEaOp, ULONG uLevel); 251 APIRET vboxSfOs2MakeEmptyEaListEx(PEAOP pEaOp, ULONG uLevel, uint32_t *pcbWritten, ULONG *poffError);251 APIRET vboxSfOs2MakeEmptyEaListEx(PEAOP pEaOp, ULONG uLevel, ULONG cbFullEasLeft, uint32_t *pcbWritten, ULONG *poffError); 252 252 253 253 DECLASM(PVBOXSFVP) Fsh32GetVolParams(USHORT hVbp, PVPFSI *ppVpFsi /*optional*/);
Note:
See TracChangeset
for help on using the changeset viewer.