50 lines
1.6 KiB
Diff
50 lines
1.6 KiB
Diff
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c"
|
|
index 98e13bc..34d6496 100644
|
|
--- "a/src/tool_doswin.c"
|
|
+++ "b/src/tool_doswin.c"
|
|
@@ -627,22 +627,32 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
|
|
if((curlinfo->features & CURL_VERSION_SSL) &&
|
|
backend != CURLSSLBACKEND_SCHANNEL) {
|
|
|
|
- DWORD res_len;
|
|
- TCHAR buf[PATH_MAX];
|
|
- TCHAR *ptr = NULL;
|
|
-
|
|
- buf[0] = TEXT('\0');
|
|
-
|
|
- res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr);
|
|
- if(res_len > 0) {
|
|
- Curl_safefree(config->cacert);
|
|
+ static const size_t BUFFSIZE = 512;
|
|
+ TCHAR filebuffer[BUFFSIZE];
|
|
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
|
|
+ if(len > 0 && len < BUFFSIZE) {
|
|
#ifdef UNICODE
|
|
- config->cacert = curlx_convert_wchar_to_UTF8(buf);
|
|
+ char *bundle_name = curlx_convert_wchar_to_UTF8(bundle_file);
|
|
+ char *module_path = curlx_convert_wchar_to_UTF8(filebuffer);
|
|
#else
|
|
- config->cacert = strdup(buf);
|
|
+ char *bundle_name = strdup(bundle_file);
|
|
+ char *module_path = strdup(filebuffer);
|
|
#endif
|
|
- if(!config->cacert)
|
|
+ if (module_path && bundle_name) {
|
|
+ char *lastdirchar = strrchr(module_path, '\\');
|
|
+ if(lastdirchar) {
|
|
+ *lastdirchar = '\0';
|
|
+ }
|
|
+ Curl_safefree(config->cacert);
|
|
+ config->cacert = curl_maprintf("%s%s%s", module_path, DIR_CHAR, bundle_name);
|
|
+ if(!config->cacert)
|
|
+ result = CURLE_OUT_OF_MEMORY;
|
|
+ }
|
|
+ else
|
|
result = CURLE_OUT_OF_MEMORY;
|
|
+
|
|
+ free(bundle_name);
|
|
+ free(module_path);
|
|
}
|
|
}
|
|
|