VirtualBox

Changeset 94249 in vbox for trunk


Ignore:
Timestamp:
Mar 15, 2022 4:16:42 PM (3 years ago)
Author:
vboxsync
Message:

Main: Guest Properties: ​bugref:10185 post-review fixes.

  • VirtualBox::i_onGuestPropertyChanged: do not pass BOOL as a reference;
  • VbglR3GuestPropWait: improve host buffer validation.
Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibGuestProp.cpp

    r94184 r94249  
    998998            *ppszFlags = pszFlags;
    999999
    1000         /* Validate / skip 'Flags'. */
     1000        /* Skip 'Flags' and deal with 'fWasDeleted' if it's present. */
    10011001        char *pszWasDeleted = RTStrEnd(pszFlags, cbBuf - (pszFlags - (char *)pvBuf)) + 1;
    10021002        AssertPtrReturn(pszWasDeleted, VERR_TOO_MUCH_DATA);
     1003        char chWasDeleted = 0;
     1004        if (   (size_t)pszWasDeleted - (size_t)pvBuf < cbBuf
     1005            && (chWasDeleted = *pszWasDeleted) != '\0')
     1006            AssertMsgReturn((chWasDeleted == '0' || chWasDeleted == '1') && pszWasDeleted[1] == '\0',
     1007                            ("'%s'\n", pszWasDeleted), VERR_PARSE_ERROR);
    10031008        if (pfWasDeleted)
    1004         {
    1005             AssertReturn(pszWasDeleted[0] == '0' || pszWasDeleted[0] == '1', VERR_PARSE_ERROR);
    1006             *pfWasDeleted = pszWasDeleted[0] == '0' ? false : true;
    1007         }
     1009            *pfWasDeleted = chWasDeleted == '1';
    10081010
    10091011        /* Validate end of buffer string. */
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r94184 r94249  
    176176
    177177    void i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags,
    178                                   const BOOL &fWasDeleted);
     178                                  const BOOL fWasDeleted);
    179179    void i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, const Utf8Str &aName,
    180180                                NATProtocol_T aProto, const Utf8Str &aHostIp, uint16_t aHostPort,
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r94184 r94249  
    36093609 */
    36103610void VirtualBox::i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue,
    3611                                           const Utf8Str &aFlags, const BOOL &fWasDeleted)
     3611                                          const Utf8Str &aFlags, const BOOL fWasDeleted)
    36123612{
    36133613    ComPtr<IEvent> ptrEvent;
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