VirtualBox

Changeset 84261 in vbox


Ignore:
Timestamp:
May 11, 2020 4:43:10 PM (5 years ago)
Author:
vboxsync
Message:

Guest Control: Partly reverted r137851 and r137880 to remove the paranoia checks whether the cmd/args/env lengths are supported; the GA should handle that in turn as it was decided. ​​​bugref:9320

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp

    r84260 r84261  
    10631063        return VERR_BUFFER_OVERFLOW;
    10641064
    1065     Guest *pGuest = mSession->i_getParent();
    1066     AssertPtr(pGuest);
    1067 
    1068     const uint64_t fGuestControlFeatures0 = pGuest->i_getGuestControlFeatures0();
    1069 
    1070     /* If the guest does not support dynamic sizes, make sure that we check limits here. */
    1071     if (   !(fGuestControlFeatures0 & VBOX_GUESTCTRL_GF_0_PROCESS_DYNAMIC_SIZES)
    1072         &&  mData.mProcess.mExecutable.length() + 1 /* Include termination */ > GUESTPROCESS_DEFAULT_CMD_LEN)
    1073         return VERR_BUFFER_OVERFLOW;
    1074 
    10751065    size_t cbArgs = 0;
    10761066    char *pszArgs = NULL;
     
    10871077        }
    10881078        papszArgv[cArgs] = NULL;
     1079
     1080        Guest *pGuest = mSession->i_getParent();
     1081        AssertPtr(pGuest);
     1082
     1083        const uint64_t fGuestControlFeatures0 = pGuest->i_getGuestControlFeatures0();
    10891084
    10901085        /* If the Guest Additions don't support using argv[0] correctly (< 6.1.x), don't supply it. */
     
    10991094
    11001095        /* Note! No direct returns after this. */
    1101 
    1102         /* Calculate arguments size (in bytes). */
    1103         AssertPtr(pszArgs);
    1104         cbArgs = strlen(pszArgs) + 1; /* Include terminating zero. */
    1105 
    1106         /* If the guest does not support dynamic sizes, make sure that we check limits here. */
    1107         if (   !(fGuestControlFeatures0 & VBOX_GUESTCTRL_GF_0_PROCESS_DYNAMIC_SIZES)
    1108             && cbArgs > GUESTPROCESS_DEFAULT_ARGS_LEN)
    1109         {
    1110             vrc = VERR_BUFFER_OVERFLOW;
    1111         }
    1112     }
     1096    }
     1097
     1098    /* Calculate arguments size (in bytes). */
     1099    AssertPtr(pszArgs);
     1100    cbArgs = strlen(pszArgs) + 1; /* Include terminating zero. */
    11131101
    11141102    /* Prepare environment.  The guest service dislikes the empty string at the end, so drop it. */
    11151103    size_t  cbEnvBlock   = 0;    /* Shut up MSVC. */
    11161104    char   *pszzEnvBlock = NULL; /* Ditto. */
    1117     if (RT_SUCCESS(vrc))
    1118         vrc = mData.mProcess.mEnvironmentChanges.queryUtf8Block(&pszzEnvBlock, &cbEnvBlock);
    1119     if (RT_SUCCESS(vrc))
    1120     {
    1121         /* If the guest does not support dynamic sizes, make sure that we check limits here. */
    1122         if (   !(fGuestControlFeatures0 & VBOX_GUESTCTRL_GF_0_PROCESS_DYNAMIC_SIZES)
    1123             && cbEnvBlock > GUESTPROCESS_DEFAULT_ENV_LEN)
    1124             vrc = VERR_BUFFER_OVERFLOW;
    1125     }
    1126 
     1105    vrc = mData.mProcess.mEnvironmentChanges.queryUtf8Block(&pszzEnvBlock, &cbEnvBlock);
    11271106    if (RT_SUCCESS(vrc))
    11281107    {
     
    11781157            AssertRC(rc2);
    11791158        }
    1180     }
    1181 
    1182     if (pszzEnvBlock)
    1183     {
     1159
    11841160        mData.mProcess.mEnvironmentChanges.freeUtf8Block(pszzEnvBlock);
    1185         pszzEnvBlock = NULL;
    11861161    }
    11871162
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