Changeset 77537 in vbox for trunk/src/VBox/Additions/linux/sharedfolders
- Timestamp:
- Mar 2, 2019 3:27:42 PM (6 years ago)
- Location:
- trunk/src/VBox/Additions/linux/sharedfolders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/linux/sharedfolders/dirops.c
r77536 r77537 202 202 sf_d->cbValid = 0; 203 203 sf_d->pEntry = NULL; 204 sf_d->fNoMoreFiles = false; 204 205 if (sf_d->pBuf) { 205 206 kfree(sf_d->pBuf); … … 251 252 252 253 /* 254 * Don't call the host again if we've reached the end of the 255 * directory entries already. 256 */ 257 if (sf_d->fNoMoreFiles) { 258 if (!fRestart) 259 return 0; 260 sf_d->fNoMoreFiles = false; 261 } 262 263 264 /* 253 265 * Make sure we've got some kind of buffers. 254 266 */ … … 256 268 /* Likely, except for the first time. */ 257 269 } else { 258 sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_ 16K, GFP_KERNEL);270 sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_64K, GFP_KERNEL); 259 271 if (sf_d->pBuf) 260 sf_d->cbBuf = _ 16K;272 sf_d->cbBuf = _64K; 261 273 else { 262 274 sf_d->pBuf = (PSHFLDIRINFO)kmalloc(_4K, GFP_KERNEL); … … 281 293 sf_d->cbValid = pReq->Parms.cb32Buffer.u.value32; 282 294 sf_d->cEntriesLeft = pReq->Parms.c32Entries.u.value32; 295 sf_d->fNoMoreFiles = pReq->Parms.f32More.u.value32 == 0; 283 296 } else { 284 297 sf_d->pEntry = sf_d->pBuf; 285 298 sf_d->cbValid = 0; 286 299 sf_d->cEntriesLeft = 0; 287 if (rc == VERR_NO_MORE_FILES) 300 if (rc == VERR_NO_MORE_FILES) { 301 sf_d->fNoMoreFiles = true; 288 302 rc = 0; 289 else {303 } else { 290 304 /* In theory we could end up here with a buffer overflow, but 291 305 with a 4KB minimum buffer size that's very unlikely with the … … 558 572 */ 559 573 uintptr_t const offEntryInBuf = (uintptr_t)pEntry - (uintptr_t)pBuf; 560 uint16_t cbSrcName;561 uint16_t cchSrcName;574 uint16_t cbSrcName; 575 uint16_t cchSrcName; 562 576 AssertLogRelMsgBreak(offEntryInBuf + RT_UOFFSETOF(SHFLDIRINFO, name.String) <= cbValid, 563 577 ("%#llx + %#x vs %#x\n", offEntryInBuf, RT_UOFFSETOF(SHFLDIRINFO, name.String), cbValid)); … … 597 611 sf_d->cEntriesLeft = cEntriesLeft; 598 612 sf_d->pEntry = pEntry; 613 sf_d->offPos = offPos; 599 614 return 0; 600 615 } … … 613 628 } while (cEntriesLeft > 0); 614 629 615 /* Reset the state. */ 630 /* Done with all available entries. */ 631 sf_d->offPos = offPos + cEntriesLeft; 632 sf_d->pEntry = pBuf; 616 633 sf_d->cEntriesLeft = 0; 617 sf_d->pEntry = pBuf;618 634 } 619 635 -
trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h
r77536 r77537 39 39 # define VBOX_STRICT 40 40 #endif 41 #define VBSF_BUFFER_DIRS /* till I've fully tested the other code */42 41 43 42 #define LOG_GROUP LOG_GROUP_SHARED_FOLDERS … … 55 54 #include <iprt/asm.h> 56 55 #include "vbsfmount.h" 57 58 56 59 57 /* … … 293 291 /** The next entry. */ 294 292 PSHFLDIRINFO pEntry; 293 /** Set if there are no more files. */ 294 bool fNoMoreFiles; 295 295 #else 296 296 /** List of vbsf_dir_buf. */
Note:
See TracChangeset
for help on using the changeset viewer.