Changeset 79003 in vbox
- Timestamp:
- Jun 5, 2019 3:49:08 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 131144
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrNative.cpp
r76553 r79003 196 196 AssertMsgReturn(cchFilename < (RTPATH_MAX / 4) * 3, ("%zu\n", cchFilename), VERR_INVALID_PARAMETER); 197 197 198 const char *pszSuffix = "";198 const char *pszSuffix = NULL; 199 199 if (!RTPathHasSuffix(pszFilename)) 200 200 pszSuffix = RTLdrGetSuff(); -
trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp
r76553 r79003 42 42 43 43 44 /********************************************************************************************************************************* 45 * Global Variables * 46 *********************************************************************************************************************************/ 47 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS) 48 static const char g_szSuff[] = ".DLL"; 49 #elif defined(RT_OS_L4) 50 static const char g_szSuff[] = ".s.so"; 51 #elif defined(RT_OS_DARWIN) 52 static const char g_szSuff[] = ".dylib"; 53 #else 54 static const char g_szSuff[] = ".so"; 55 #endif 56 57 44 58 DECLHIDDEN(int) rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, PRTERRINFO pErrInfo) 45 59 { … … 49 63 if (!RTPathHasSuffix(pszFilename) && !(fFlags & RTLDRLOAD_FLAGS_NO_SUFFIX)) 50 64 { 51 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)52 static const char s_szSuff[] = ".DLL";53 #elif defined(RT_OS_L4)54 static const char s_szSuff[] = ".s.so";55 #elif defined(RT_OS_DARWIN)56 static const char s_szSuff[] = ".dylib";57 #else58 static const char s_szSuff[] = ".so";59 #endif60 65 size_t cch = strlen(pszFilename); 61 char *psz = (char *)alloca(cch + sizeof( s_szSuff));66 char *psz = (char *)alloca(cch + sizeof(g_szSuff)); 62 67 if (!psz) 63 68 return RTErrInfoSet(pErrInfo, VERR_NO_MEMORY, "alloca failed"); 64 69 memcpy(psz, pszFilename, cch); 65 memcpy(psz + cch, s_szSuff, sizeof(s_szSuff));70 memcpy(psz + cch, g_szSuff, sizeof(g_szSuff)); 66 71 pszFilename = psz; 67 72 } … … 128 133 DECLHIDDEN(int) rtldrNativeLoadSystem(const char *pszFilename, const char *pszExt, uint32_t fFlags, PRTLDRMOD phLdrMod) 129 134 { 130 RT_NOREF_PV(pszFilename); RT_NOREF_PV(pszExt); RT_NOREF_PV(fFlags); RT_NOREF_PV(phLdrMod); 131 /** @todo implement this in some sensible fashion. */ 132 return VERR_NOT_SUPPORTED; 135 /* 136 * For the present we ASSUME that we can trust dlopen to load what we want 137 * when not specifying a path. There seems to be very little we can do to 138 * restrict the places dlopen will search for library without doing 139 * auditing (linux) or something like that. 140 */ 141 Assert(strchr(pszFilename, '/') == NULL); 142 143 /* Easy if suffix was included. */ 144 if (!pszExt) 145 return RTLdrLoadEx(pszFilename, phLdrMod, fFlags, NULL); 146 147 /* Combine filename and suffix and then do the loading. */ 148 size_t const cchFilename = strlen(pszFilename); 149 size_t const cchSuffix = strlen(pszExt); 150 char *pszTmp = (char *)alloca(cchFilename + cchSuffix + 1); 151 memcpy(pszTmp, pszFilename, cchFilename); 152 memcpy(&pszTmp[cchFilename], pszExt, cchSuffix); 153 pszTmp[cchFilename + cchSuffix] = '\0'; 154 155 return RTLdrLoadEx(pszTmp, phLdrMod, fFlags, NULL); 133 156 } 134 157
Note:
See TracChangeset
for help on using the changeset viewer.