mirror of
https://github.com/curl/curl.git
synced 2026-06-01 19:44:16 +03:00
formpost: trying to attach a directory no longer crashes
The error path would previously add a freed entry to the linked list. Reported-by: Toby Peterson Fixes #1053
This commit is contained in:
parent
54e48b14e1
commit
bdf162af25
1 changed files with 8 additions and 7 deletions
|
|
@ -863,13 +863,6 @@ static CURLcode AddFormData(struct FormData **formp,
|
|||
|
||||
newform->type = type;
|
||||
|
||||
if(*formp) {
|
||||
(*formp)->next = newform;
|
||||
*formp = newform;
|
||||
}
|
||||
else
|
||||
*formp = newform;
|
||||
|
||||
if(size) {
|
||||
if(type != FORM_FILE)
|
||||
/* for static content as well as callback data we add the size given
|
||||
|
|
@ -889,6 +882,14 @@ static CURLcode AddFormData(struct FormData **formp,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(*formp) {
|
||||
(*formp)->next = newform;
|
||||
*formp = newform;
|
||||
}
|
||||
else
|
||||
*formp = newform;
|
||||
|
||||
return CURLE_OK;
|
||||
error:
|
||||
if(newform)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue