VirtualBox

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


Ignore:
Timestamp:
Feb 6, 2013 2:04:14 PM (12 years ago)
Author:
vboxsync
Message:

Forward ported r83625 + r83626 (VBoxServiceVMInfo: Don't NULL LA client info, check for more pointers, VBoxServiceUtils: Pointer checks, don't leak property values if access is denied).

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceUtils.cpp

    r44097 r44570  
    111111    }
    112112
    113     RTMemFree(pvBuf);
     113    if (pvBuf)
     114        RTMemFree(pvBuf);
    114115    return rc;
    115116}
     
    168169                            char **ppszValue, char **ppszFlags, uint64_t *puTimestamp)
    169170{
    170     char *pszFlags;
    171     int rc = VBoxServiceReadProp(u32ClientId, pszPropName, ppszValue, &pszFlags, puTimestamp);
     171    AssertPtrReturn(ppszValue, VERR_INVALID_PARAMETER);
     172
     173    char *pszValue = NULL;
     174    char *pszFlags = NULL;
     175    int rc = VBoxServiceReadProp(u32ClientId, pszPropName, &pszValue, &pszFlags, puTimestamp);
    172176    if (RT_SUCCESS(rc))
    173177    {
     
    181185        }
    182186
    183         if (ppszFlags)
    184             *ppszFlags = pszFlags;
     187        if (RT_SUCCESS(rc))
     188        {
     189            *ppszValue = pszValue;
     190
     191            if (ppszFlags)
     192                *ppszFlags = pszFlags;
     193            else if (pszFlags)
     194                RTStrFree(pszFlags);
     195        }
    185196        else
    186             RTStrFree(pszFlags);
     197        {
     198            if (pszValue)
     199                RTStrFree(pszValue);
     200            if (pszFlags)
     201                RTStrFree(pszFlags);
     202        }
    187203    }
    188204
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r44528 r44570  
    307307    {
    308308        if (pClient->pszName)
     309        {
    309310            RTStrFree(pClient->pszName);
     311            pClient->pszName = NULL;
     312        }
    310313        if (pClient->pszLocation)
     314        {
    311315            RTStrFree(pClient->pszLocation);
     316            pClient->pszLocation = NULL;
     317        }
    312318        if (pClient->pszDomain)
     319        {
    313320            RTStrFree(pClient->pszDomain);
    314 
    315         pClient = NULL;
     321            pClient->pszDomain = NULL;
     322        }
    316323    }
    317324}
     
    753760    if (pszUserList)
    754761        RTStrFree(pszUserList);
     762
     763    VBoxServiceVerbose(4, "Writing users returned with rc=%Rrc\n", rc);
    755764    return rc;
    756765}
     
    11921201
    11931202        /* Check for new connection. */
    1194         char *pszLAClientID;
     1203        char *pszLAClientID = NULL;
    11951204        int rc2 = VBoxServiceReadHostProp(g_uVMInfoGuestPropSvcClientID, g_pszLAActiveClient, true /* Read only */,
    11961205                                          &pszLAClientID, NULL /* Flags */, NULL /* Timestamp */);
    11971206        if (RT_SUCCESS(rc2))
    11981207        {
     1208            AssertPtr(pszLAClientID);
    11991209            if (RTStrICmp(pszLAClientID, "0")) /* Is a client connected? */
    12001210            {
     
    12591269        }
    12601270
     1271        VBoxServiceVerbose(3, "VRDP: Handling location awareness done\n");
     1272
    12611273        /*
    12621274         * Flush all properties if we were restored.
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