Make sure that HAVE_WRITABLE_ARGV is defined.

This commit is contained in:
LoRd_MuldeR 2023-12-07 03:46:35 +01:00
parent d1db4a3e39
commit 5c7c02f159
2 changed files with 39 additions and 9 deletions

View File

@ -1,10 +1,7 @@
src/tool_doswin.c | 49 ++++++++++++++++++++++++++++++++++---------------
1 file changed, 34 insertions(+), 15 deletions(-)
diff --git a/src/tool_doswin.c b/src/tool_doswin.c
index e9347d2..558d15d 100644
--- a/src/tool_doswin.c
+++ b/src/tool_doswin.c
diff --git "a/src/tool_doswin.c" "b/src/tool_doswin.c"
index db2b8b7..fb267ae 100644
--- "a/src/tool_doswin.c"
+++ "b/src/tool_doswin.c"
@@ -614,6 +614,37 @@ char **__crt0_glob_function(char *arg)
* HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode
*/
@ -68,3 +65,25 @@ index e9347d2..558d15d 100644
}
}
@@ -776,6 +795,8 @@ bool tool_isVistaOrGreater;
CURLcode win32_init(void)
{
+ size_t acmdln_len, wcmdln_len;
+
/* curlx_verify_windows_version must be called during init at least once
because it has its own initialization routine. */
if(curlx_verify_windows_version(6, 0, 0, PLATFORM_WINNT,
@@ -788,6 +809,12 @@ CURLcode win32_init(void)
init_terminal();
+ SecureZeroMemory(_acmdln, acmdln_len = strlen(_acmdln) * sizeof(char));
+ SecureZeroMemory(_wcmdln, wcmdln_len = wcslen(_wcmdln) * sizeof(wchar_t));
+
+ if (acmdln_len >= 4) strcpy(_acmdln, "curl");
+ if (wcmdln_len >= 4) wcscpy(_wcmdln, L"curl");
+
return CURLE_OK;
}

View File

@ -1,8 +1,19 @@
diff --git "a/src/tool_getparam.c" "b/src/tool_getparam.c"
index 5fa1ace..a1b54f4 100644
index 5fa1ace..730400c 100644
--- "a/src/tool_getparam.c"
+++ "b/src/tool_getparam.c"
@@ -563,8 +563,13 @@ static void cleanarg(argv_item_t str)
@@ -23,6 +23,10 @@
***************************************************************************/
#include "tool_setup.h"
+#ifndef HAVE_WRITABLE_ARGV
+#define HAVE_WRITABLE_ARGV 1
+#endif
+
#include "strcase.h"
#define ENABLE_CURLX_PRINTF
@@ -563,8 +567,13 @@ static void cleanarg(argv_item_t str)
* argument out so that the username:password isn't displayed in the
* system process list */
if(str) {