VirtualBox

Changeset 91740 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
Oct 14, 2021 7:28:04 PM (3 years ago)
Author:
vboxsync
Message:

VbglR3ClipboardWriteDataEx: Don't validate pvData when cbData == 0, as it's perferectly valid to write a zero byte reply to a host's request. bugref:10094

File:
1 edited

Legend:

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

    r91387 r91740  
    24622462 *
    24632463 * @returns VBox status code.
    2464  * @param   idClient        The client id returned by VbglR3ClipboardConnect().
    2465  * @param   fFormat         The format of the data.
    2466  * @param   pv              The data.
    2467  * @param   cb              The size of the data.
     2464 * @param   idClient    The client id returned by VbglR3ClipboardConnect().
     2465 * @param   fFormat     The format of the data.
     2466 * @param   pvData      Pointer to the data to send.  Can be NULL if @a cbData
     2467 *                      is zero.
     2468 * @param   cbData      Number of bytes of data to send.  Zero is valid.
    24682469 */
    24692470VBGLR3DECL(int) VbglR3ClipboardWriteData(HGCMCLIENTID idClient, uint32_t fFormat, void *pv, uint32_t cb)
     
    24942495 *
    24952496 * @returns VBox status code.
    2496  * @param   pCtx                The command context returned by VbglR3ClipboardConnectEx().
    2497  * @param   uFormat             Clipboard format to send.
    2498  * @param   pvData              Pointer to data to send.
    2499  * @param   cbData              Size (in bytes) of data to send.
    2500  */
    2501 VBGLR3DECL(int) VbglR3ClipboardWriteDataEx(PVBGLR3SHCLCMDCTX pCtx, SHCLFORMAT uFormat, void *pvData, uint32_t cbData)
    2502 {
    2503     AssertPtrReturn(pCtx,   VERR_INVALID_POINTER);
    2504     AssertPtrReturn(pvData, VERR_INVALID_POINTER);
     2497 * @param   pCtx        The command context returned by VbglR3ClipboardConnectEx().
     2498 * @param   fFormat     Clipboard format to send.
     2499 * @param   pvData      Pointer to the data to send.  Can be NULL if @a cbData
     2500 *                      is zero.
     2501 * @param   cbData      Number of bytes of data to send.  Zero is valid.
     2502 */
     2503VBGLR3DECL(int) VbglR3ClipboardWriteDataEx(PVBGLR3SHCLCMDCTX pCtx, SHCLFORMAT fFormat, void *pvData, uint32_t cbData)
     2504{
     2505    LogFlowFunc(("ENTER: fFormat=%#x pvData=%p cbData=%#x\n", fFormat, pvData, cbData));
     2506    AssertPtrReturn(pCtx, VERR_INVALID_POINTER);
     2507    if (cbData > 0)
     2508        AssertPtrReturn(pvData, VERR_INVALID_POINTER);
    25052509
    25062510    int rc;
    2507 
    2508     LogFlowFuncEnter();
    2509 
    25102511    if (pCtx->fUseLegacyProtocol)
    2511     {
    2512         rc = VbglR3ClipboardWriteData(pCtx->idClient, uFormat, pvData, cbData);
    2513     }
     2512        rc = VbglR3ClipboardWriteData(pCtx->idClient, fFormat, pvData, cbData);
    25142513    else
    25152514    {
     
    25222521        VBGL_HGCM_HDR_INIT(&Msg.Hdr, pCtx->idClient, VBOX_SHCL_GUEST_FN_DATA_WRITE, VBOX_SHCL_CPARMS_DATA_WRITE);
    25232522        Msg.Parms.id64Context.SetUInt64(pCtx->idContext);
    2524         Msg.Parms.f32Format.SetUInt32(uFormat);
     2523        Msg.Parms.f32Format.SetUInt32(fFormat);
    25252524        Msg.Parms.pData.SetPtr(pvData, cbData);
    25262525
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