VirtualBox

Ignore:
Timestamp:
Mar 9, 2017 1:02:50 PM (8 years ago)
Author:
vboxsync
Message:

tstSharedFolderService: fix the loop.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/testcase/tstSharedFolderService.cpp

    r66011 r66012  
    511511                               const char *pcszSource)
    512512{
    513     AssertRelease(  strlen(pcszSource) * 2 + 2
     513    const size_t cchSource = strlen(pcszSource);
     514    AssertRelease(  cchSource * 2 + 2
    514515                  < sizeof(*pDest) - RT_UOFFSETOF(SHFLSTRING, String));
    515     pDest->string.u16Length = (uint16_t)(strlen(pcszSource) * sizeof(RTUTF16));
     516    pDest->string.u16Length = (uint16_t)(cchSource * sizeof(RTUTF16));
    516517    pDest->string.u16Size   = pDest->string.u16Length + sizeof(RTUTF16);
    517     for (unsigned i = 0; i <= pDest->string.u16Length; ++i)
     518    /* Copy pcszSource ASCIIZ, including the trailing 0, to the UTF16 pDest->string.String.ucs2. */
     519    for (unsigned i = 0; i <= cchSource; ++i)
    518520        ((uint16_t*)pDest->string.String.ucs2)[i] = (uint16_t)pcszSource[i];
    519521}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette