88 lines
2.9 KiB
Diff
88 lines
2.9 KiB
Diff
From 206550a9c25e2084012f616dcce90142a30a8f80 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Stenberg <daniel@haxx.se>
|
|
Date: Sat, 23 Jul 2022 13:33:57 +0200
|
|
Subject: [PATCH] tool_getparam: fix cleanarg() for unicode builds
|
|
|
|
Use the correct type, and make cleanarg an empty macro if the cleaning
|
|
ability is absent.
|
|
|
|
Fixes #9195
|
|
Closes #9196
|
|
|
|
Reviewed-by: Jay Satiro
|
|
Reviewed-by: Marcel Raad
|
|
---
|
|
src/tool_getparam.c | 14 +++++++-------
|
|
src/tool_getparam.h | 3 ++-
|
|
2 files changed, 9 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
|
|
index 6423c8fe1..9bbd51d34 100644
|
|
--- a/src/tool_getparam.c
|
|
+++ b/src/tool_getparam.c
|
|
@@ -541,9 +541,9 @@ static ParameterError GetSizeParameter(struct GlobalConfig *global,
|
|
return PARAM_OK;
|
|
}
|
|
|
|
-static void cleanarg(char *str)
|
|
-{
|
|
#ifdef HAVE_WRITABLE_ARGV
|
|
+static void cleanarg(argv_item_t str)
|
|
+{
|
|
/* now that GetStr has copied the contents of nextarg, wipe the next
|
|
* argument out so that the username:password isn't displayed in the
|
|
* system process list */
|
|
@@ -551,14 +551,14 @@ static void cleanarg(char *str)
|
|
size_t len = strlen(str);
|
|
memset(str, ' ', len);
|
|
}
|
|
+}
|
|
#else
|
|
- (void)str;
|
|
+#define cleanarg(x)
|
|
#endif
|
|
-}
|
|
|
|
ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|
char *nextarg, /* NULL if unset */
|
|
- char *clearthis,
|
|
+ argv_item_t clearthis,
|
|
bool *usedarg, /* set to TRUE if the arg
|
|
has been used */
|
|
struct GlobalConfig *global,
|
|
@@ -576,7 +576,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|
ParameterError err;
|
|
bool toggle = TRUE; /* how to switch boolean options, on or off. Controlled
|
|
by using --OPTION or --no-OPTION */
|
|
-
|
|
+ (void)clearthis; /* for !HAVE_WRITABLE_ARGV builds */
|
|
*usedarg = FALSE; /* default is that we don't use the arg */
|
|
|
|
if(('-' != flag[0]) || ('-' == flag[1])) {
|
|
@@ -2440,7 +2440,7 @@ ParameterError parse_args(struct GlobalConfig *global, int argc,
|
|
stillflags = FALSE;
|
|
else {
|
|
char *nextarg = NULL;
|
|
- char *clear = NULL;
|
|
+ argv_item_t clear = NULL;
|
|
if(i < (argc - 1)) {
|
|
nextarg = curlx_convert_tchar_to_UTF8(argv[i + 1]);
|
|
if(!nextarg) {
|
|
diff --git a/src/tool_getparam.h b/src/tool_getparam.h
|
|
index e35136123..0564518a6 100644
|
|
--- a/src/tool_getparam.h
|
|
+++ b/src/tool_getparam.h
|
|
@@ -54,7 +54,8 @@ typedef enum {
|
|
struct GlobalConfig;
|
|
struct OperationConfig;
|
|
|
|
-ParameterError getparameter(const char *flag, char *nextarg, char *clearthis,
|
|
+ParameterError getparameter(const char *flag, char *nextarg,
|
|
+ argv_item_t clearthis,
|
|
bool *usedarg,
|
|
struct GlobalConfig *global,
|
|
struct OperationConfig *operation);
|
|
--
|
|
2.33.0
|
|
|