VirtualBox

Changeset 19220 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 27, 2009 3:54:13 PM (16 years ago)
Author:
vboxsync
Message:

SharedClipboard/x11: fix a potential crash if a zero-length compound text string is read

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/clipboard.cpp

    r19150 r19220  
    390390    LogFlow(("vboxClipboardGetCText: converting compound text to Utf-16LE. Original is %.*s\n",
    391391           cbSourceLen, pValue));
     392    /* Quick fix for 2.2. */
     393    if (cbSourceLen == 0)
     394    {
     395        XtFree(reinterpret_cast<char *>(pValue));
     396        vboxClipboardSendData(VBOX_SHARED_CLIPBOARD_FMT_UNICODETEXT,
     397                              NULL, 0);       
     398    }
    392399    /* First convert the compound text to Utf8 */
    393400    property.value = reinterpret_cast<unsigned char *>(pValue);
  • trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp

    r19219 r19220  
    320320                   cbSrcLen, cb, cbSrcLen, reinterpret_cast<char *>(pValue)));
    321321    *pcbActual = 0;  /* Only set this to the right value on success. */
     322    /** @todo quick fix for 2.2, do this properly. */
     323    if (cbSrcLen == 0)
     324    {
     325        XtFree(reinterpret_cast<char *>(pValue));
     326        if (cb < 2)
     327            return VERR_BUFFER_OVERFLOW;
     328        *(PRTUTF16) pv = 0;
     329        *pcbActual = 2;
     330        return VINF_SUCCESS;
     331    }
    322332    /* First convert the compound text to Utf8 */
    323333    property.value = reinterpret_cast<unsigned char *>(pValue);
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