VirtualBox

Changeset 100209 in vbox for trunk


Ignore:
Timestamp:
Jun 19, 2023 2:29:26 PM (18 months ago)
Author:
vboxsync
Message:

Shared Clipboard/X11: Fixed checks for SHCL_MAX_X11_FORMATS. Found by Parfait.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r100204 r100209  
    20702070    LogFlowFunc(("uFmtVBox=%#x, idxFmtX11=%u, pvSrc=%p, cbSrc=%u\n", pReq->Read.uFmtVBox, pReq->Read.idxFmtX11, pvSrc, cbSrc));
    20712071
     2072    /* Sanity. */
     2073    AssertReturnVoid(pReq->Read.uFmtVBox != VBOX_SHCL_FMT_NONE);
     2074    AssertReturnVoid(pReq->Read.idxFmtX11 < SHCL_MAX_X11_FORMATS);
     2075
     2076    AssertPtrReturnVoid(pReq->pCtx);
     2077
    20722078    LogRel2(("Shared Clipboard: Converting X11 format '%s' to VBox format %#x (%RU32 bytes max)\n",
    20732079             g_aFormats[pReq->Read.idxFmtX11].pcszAtom, pReq->Read.uFmtVBox, pReq->Read.cbMax));
    2074 
    2075     AssertPtr(pReq->pCtx);
    2076     Assert(pReq->Read.uFmtVBox != VBOX_SHCL_FMT_NONE); /* Sanity. */
    20772080
    20782081    int rc = VINF_SUCCESS;
     
    23592362            char *pszFmts = ShClFormatsToStrA(pReq->Read.uFmtVBox);
    23602363            AssertPtrReturnVoid(pszFmts);
    2361             AssertReturnVoid(pReq->Read.idxFmtX11 <= SHCL_MAX_X11_FORMATS); /* Paranoia, should be checked already by the caller. */
     2364            AssertReturnVoid(pReq->Read.idxFmtX11 < SHCL_MAX_X11_FORMATS); /* Paranoia, should be checked already by the caller. */
    23622365            LogRel2(("Shared Clipboard: Converting X11 format '%s' -> VBox format(s) '%s'\n", g_aFormats[pReq->Read.idxFmtX11].pcszAtom, pszFmts));
    23632366            RTStrFree(pszFmts);
     
    24062409{
    24072410    AssertPtrReturn(pszWhere, VERR_INVALID_POINTER);
    2408     AssertReturn(idxFmt <= SHCL_MAX_X11_FORMATS, VERR_INVALID_PARAMETER);
     2411    AssertReturn(idxFmt < SHCL_MAX_X11_FORMATS, VERR_INVALID_PARAMETER);
    24092412    AssertReturn(clipIsSupportedSelectionType(pCtx, clipGetAtom(pCtx, pszWhere)), VERR_INVALID_PARAMETER);
    24102413    AssertPtrReturn(pReq, VERR_INVALID_POINTER);
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