mirror of
https://github.com/curl/curl.git
synced 2026-07-28 01:33:11 +03:00
tool_operate: bail out better on no URL
To avoid NULL derferences with many outputs and --next.
Follow-up to 034612cd51
Add test 760 to verify
Reported-by: BobodevMm on github
Fixes #18375
Closes #18376
This commit is contained in:
parent
1e430f806a
commit
29e4a124a3
3 changed files with 36 additions and 6 deletions
|
|
@ -1119,6 +1119,11 @@ static CURLcode single_transfer(struct OperationConfig *config,
|
|||
struct getout *u = state->urlnode;
|
||||
FILE *err = (!global->silent || global->showerror) ? tool_stderr : NULL;
|
||||
|
||||
if(!u->url) {
|
||||
/* This node has no URL. End of the road. */
|
||||
warnf("Got more output options than URLs");
|
||||
break;
|
||||
}
|
||||
if(u->infile) {
|
||||
if(!config->globoff && !glob_inuse(&state->inglob))
|
||||
result = glob_url(&state->inglob, u->infile, &state->upnum, err);
|
||||
|
|
@ -1141,11 +1146,6 @@ static CURLcode single_transfer(struct OperationConfig *config,
|
|||
glob_cleanup(&state->inglob);
|
||||
state->upidx = 0;
|
||||
state->urlnode = u->next; /* next node */
|
||||
if(state->urlnode && !state->urlnode->url) {
|
||||
/* This node has no URL. End of the road. */
|
||||
warnf("Got more output options than URLs");
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue