Changeset 3387 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- Jul 3, 2007 11:36:37 AM (17 years ago)
- Location:
- trunk/src/VBox/Main/glue
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/com.cpp
r3191 r3387 133 133 } 134 134 135 int GetVBoxUserHomeDirectory ( Utf8Str &aDir)135 int GetVBoxUserHomeDirectory (char *aDir, size_t aDirLen) 136 136 { 137 AssertReturn (aDir, VERR_INVALID_POINTER); 138 AssertReturn (aDirLen > 0, VERR_BUFFER_OVERFLOW); 139 137 140 /* start with null */ 138 aDir.setNull();141 *aDir = 0; 139 142 140 143 const char *VBoxUserHome = RTEnvGet ("VBOX_USER_HOME"); … … 152 155 vrc = RTPathAbs (VBoxUserHomeUtf8, path, sizeof (path)); 153 156 if (RT_SUCCESS (vrc)) 154 aDir = path; 157 { 158 if (aDirLen < strlen (path) + 1) 159 vrc = VERR_BUFFER_OVERFLOW; 160 else 161 strcpy (aDir, path); 162 } 155 163 RTStrFree (VBoxUserHomeUtf8); 156 164 } … … 161 169 vrc = RTPathUserHome (path, sizeof (path)); 162 170 if (RT_SUCCESS (vrc)) 163 aDir = Utf8StrFmt ("%s%c%s", path, RTPATH_DELIMITER, 164 VBOX_USER_HOME_SUFFIX); 171 { 172 size_t len = 173 RTStrPrintf (aDir, aDirLen, "%s%c%s", 174 path, RTPATH_DELIMITER, VBOX_USER_HOME_SUFFIX); 175 if (len != strlen (path) + 1 + strlen (VBOX_USER_HOME_SUFFIX)) 176 vrc = VERR_BUFFER_OVERFLOW; 177 } 165 178 } 166 179 -
trunk/src/VBox/Main/glue/initterm.cpp
r2981 r3387 184 184 185 185 /* prepare paths for registry files */ 186 Utf8Str homeDir;187 int vrc = GetVBoxUserHomeDirectory (homeDir );186 char homeDir [RTPATH_MAX]; 187 int vrc = GetVBoxUserHomeDirectory (homeDir, sizeof (homeDir)); 188 188 if (RT_SUCCESS (vrc)) 189 189 { 190 Utf8Str compReg = Utf8StrFmt ("%s%c%s", homeDir.raw(), 191 RTPATH_DELIMITER, "compreg.dat"); 192 Utf8Str xptiDat = Utf8StrFmt ("%s%c%s", homeDir.raw(), 193 RTPATH_DELIMITER, "xpti.dat"); 190 char compReg [RTPATH_MAX]; 191 char xptiDat [RTPATH_MAX]; 192 193 RTStrPrintf (compReg, sizeof (compReg), "%s%c%s", 194 homeDir, RTPATH_DELIMITER, "compreg.dat"); 195 RTStrPrintf (xptiDat, sizeof (xptiDat), "%s%c%s", 196 homeDir, RTPATH_DELIMITER, "xpti.dat"); 197 194 198 dsProv = new DirectoryServiceProvider(); 195 199 if (dsProv) … … 230 234 if (RT_SUCCESS (vrc)) 231 235 { 232 nsCOMPtr <nsILocalFile> file;236 nsCOMPtr <nsILocalFile> file; 233 237 rc = NS_NewNativeLocalFile (nsEmbedCString (appDirCP), 234 238 PR_FALSE, getter_AddRefs (file));
Note:
See TracChangeset
for help on using the changeset viewer.