From 5c7c02f159a0250000564f8cd8e9cb3ebf356015 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Thu, 7 Dec 2023 03:46:35 +0100 Subject: [PATCH] Make sure that HAVE_WRITABLE_ARGV is defined. --- patch/curl_tool_doswin.diff | 33 ++++++++++++++++++++++++++------- patch/curl_tool_getparam.diff | 15 +++++++++++++-- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/patch/curl_tool_doswin.diff b/patch/curl_tool_doswin.diff index 486f66c..b877bb0 100644 --- a/patch/curl_tool_doswin.diff +++ b/patch/curl_tool_doswin.diff @@ -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; + } + diff --git a/patch/curl_tool_getparam.diff b/patch/curl_tool_getparam.diff index d434d1c..7b8d0bf 100644 --- a/patch/curl_tool_getparam.diff +++ b/patch/curl_tool_getparam.diff @@ -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) {