Changeset 25558 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Dec 22, 2009 12:45:27 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56235
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPR3HardenedMain.cpp
r25472 r25558 141 141 #endif 142 142 143 143 144 /******************************************************************************* 144 145 * Internal Functions * … … 324 325 # ifdef RT_OS_LINUX 325 326 int cchLink = readlink("/proc/self/exe", &g_szSupLibHardenedExePath[0], sizeof(g_szSupLibHardenedExePath) - 1); 327 326 328 # elif defined(RT_OS_SOLARIS) 327 329 char szFileBuf[PATH_MAX + 1]; 328 330 sprintf(szFileBuf, "/proc/%ld/path/a.out", (long)getpid()); 329 331 int cchLink = readlink(szFileBuf, &g_szSupLibHardenedExePath[0], sizeof(g_szSupLibHardenedExePath) - 1); 330 # else /* RT_OS_FREEBSD: */ 332 333 # else /* RT_OS_FREEBSD */ 331 334 int aiName[4]; 332 size_t cbPath;333 334 335 aiName[0] = CTL_KERN; 335 336 aiName[1] = KERN_PROC; … … 337 338 aiName[3] = getpid(); 338 339 339 cbPath = sizeof(g_szSupLibHardenedExePath) - 1; 340 if(sysctl(aiName, RT_ELEMENTS(aiName), g_szSupLibHardenedExePath, &cbPath, NULL, 0) < 0) 341 supR3HardenedFatal("supR3HardenedExecDir: sysctl failed\n"); 342 343 int cchLink = strlen(g_szSupLibHardenedExePath); 340 size_t cbPath = sizeof(g_szSupLibHardenedExePath); 341 if (sysctl(aiName, RT_ELEMENTS(aiName), g_szSupLibHardenedExePath, &cbPath, NULL, 0) < 0) 342 supR3HardenedFatal("supR3HardenedExecDir: sysctl failed\n"); 343 g_szSupLibHardenedExePath[sizeof(g_szSupLibHardenedExePath) - 1] = '\0'; 344 int cchLink = strlen(g_szSupLibHardenedExePath); /* paranoid? can't we use cbPath? */ 345 344 346 # endif 345 347 if (cchLink < 0 || cchLink == sizeof(g_szSupLibHardenedExePath) - 1)
Note:
See TracChangeset
for help on using the changeset viewer.