Changeset 84261 in vbox
- Timestamp:
- May 11, 2020 4:43:10 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r84260 r84261 1063 1063 return VERR_BUFFER_OVERFLOW; 1064 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 1065 size_t cbArgs = 0; 1076 1066 char *pszArgs = NULL; … … 1087 1077 } 1088 1078 papszArgv[cArgs] = NULL; 1079 1080 Guest *pGuest = mSession->i_getParent(); 1081 AssertPtr(pGuest); 1082 1083 const uint64_t fGuestControlFeatures0 = pGuest->i_getGuestControlFeatures0(); 1089 1084 1090 1085 /* If the Guest Additions don't support using argv[0] correctly (< 6.1.x), don't supply it. */ … … 1099 1094 1100 1095 /* 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. */ 1113 1101 1114 1102 /* Prepare environment. The guest service dislikes the empty string at the end, so drop it. */ 1115 1103 size_t cbEnvBlock = 0; /* Shut up MSVC. */ 1116 1104 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); 1127 1106 if (RT_SUCCESS(vrc)) 1128 1107 { … … 1178 1157 AssertRC(rc2); 1179 1158 } 1180 } 1181 1182 if (pszzEnvBlock) 1183 { 1159 1184 1160 mData.mProcess.mEnvironmentChanges.freeUtf8Block(pszzEnvBlock); 1185 pszzEnvBlock = NULL;1186 1161 } 1187 1162
Note:
See TracChangeset
for help on using the changeset viewer.