VirtualBox

Changeset 5611 in vbox


Ignore:
Timestamp:
Nov 2, 2007 11:40:44 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
25903
Message:

Fixed querying netAddress property in VRDP server.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r4876 r5611  
    644644        case VRDP_QP_NETWORK_ADDRESS:
    645645        {
    646             com::Bstr address;
    647             server->mConsole->getVRDPServer ()->COMGETTER(NetAddress) (address.asOutParam());
    648 
    649             if (cbBuffer >= address.length ())
    650             {
    651                 if (address.length () > 0)
     646            com::Bstr bstr;
     647            server->mConsole->getVRDPServer ()->COMGETTER(NetAddress) (bstr.asOutParam());
     648           
     649            /* The server expects UTF8. */
     650            com::Utf8Str address = bstr;
     651
     652            size_t cbAddress = address.length () + 1;
     653           
     654            if (cbAddress >= 0x10000)
     655            {
     656                /* More than 64K seems to be an  invalid address. */
     657                rc = VERR_TOO_MUCH_DATA;
     658                break;
     659            }
     660           
     661            if ((size_t)cbBuffer >= cbAddress)
     662            {
     663                if (cbAddress > 0)
    652664                {
    653                    memcpy (pvBuffer, address.raw(), address.length ());
     665                    memcpy (pvBuffer, address.raw(), cbAddress);
    654666                }
     667
    655668                rc = VINF_SUCCESS;
    656669            }
    657 
    658             *pcbOut = address.length ();
     670            else
     671            {
     672                rc = VINF_BUFFER_OVERFLOW;
     673            }
     674
     675            *pcbOut = (uint32_t)cbAddress;
    659676        } break;
    660677
Note: See TracChangeset for help on using the changeset viewer.

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