Skip to content
Snippets Groups Projects
Commit 0bb91218 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

added a NULL pointer check for the name field as it can in fact be NULL when

dereferenced here, if the app passes in a funny combo. Detected by coverity.com
parent 231a51fe
No related branches found
No related tags found
No related merge requests found
......@@ -743,8 +743,11 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
}
if( !(form->flags & HTTPPOST_PTRNAME) &&
(form == first_form) ) {
/* copy name (without strdup; possibly contains null characters) */
form->name = memdup(form->name, form->namelength);
/* Note that there's small risk that form->name is NULL here if the
app passed in a bad combo, so we better check for that first. */
if(form->name)
/* copy name (without strdup; possibly contains null characters) */
form->name = memdup(form->name, form->namelength);
if(!form->name) {
return_value = CURL_FORMADD_MEMORY;
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment