Changeset 84243 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 11, 2020 9:59:59 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r83472 r84243 1058 1058 const GuestCredentials &sessionCreds = pSession->i_getCredentials(); 1059 1059 1060 1061 1060 /* Prepare arguments. */ 1062 1061 size_t cArgs = mData.mProcess.mArguments.size(); … … 1064 1063 return VERR_BUFFER_OVERFLOW; 1065 1064 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 1075 size_t cbArgs = 0; 1066 1076 char *pszArgs = NULL; 1067 1077 int vrc = VINF_SUCCESS; … … 1077 1087 } 1078 1088 papszArgv[cArgs] = NULL; 1079 1080 Guest *pGuest = mSession->i_getParent();1081 AssertPtr(pGuest);1082 1083 const uint64_t fGuestControlFeatures0 = pGuest->i_getGuestControlFeatures0();1084 1089 1085 1090 /* If the Guest Additions don't support using argv[0] correctly (< 6.1.x), don't supply it. */ … … 1093 1098 return vrc; 1094 1099 1095 /* Note! No returns after this. */ 1096 } 1097 1098 /* Calculate arguments size (in bytes). */ 1099 size_t cbArgs = pszArgs ? strlen(pszArgs) + 1 : 0; /* Include terminating zero. */ 1100 /* 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 } 1100 1113 1101 1114 /* Prepare environment. The guest service dislikes the empty string at the end, so drop it. */ 1102 1115 size_t cbEnvBlock; 1103 1116 char *pszzEnvBlock; 1104 vrc = mData.mProcess.mEnvironmentChanges.queryUtf8Block(&pszzEnvBlock, &cbEnvBlock); 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 1127 if (RT_SUCCESS(vrc)) 1106 1128 {
Note:
See TracChangeset
for help on using the changeset viewer.