1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

tool_operate: check argc before accessing argv[1]

Follow-up to 09363500b
Reported-by: Emil Engler
Reviewed-by: Daniel Gustafsson
Closes #6668
This commit is contained in:
Daniel Stenberg 2021-02-26 15:00:51 +01:00
parent 8779bfe77b
commit 15bc86df33
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -2574,7 +2574,7 @@ static CURLcode run_all_transfers(struct GlobalConfig *global,
CURLcode operate(struct GlobalConfig *global, int argc, argv_item_t argv[])
{
CURLcode result = CURLE_OK;
char *first_arg = curlx_convert_tchar_to_UTF8(argv[1]);
char *first_arg = argc > 1 ? curlx_convert_tchar_to_UTF8(argv[1]) : NULL;
/* Setup proper locale from environment */
#ifdef HAVE_SETLOCALE