mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
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
This commit is contained in:
parent
231a51fe7a
commit
0bb91218c5
@ -743,6 +743,9 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||||||
}
|
}
|
||||||
if( !(form->flags & HTTPPOST_PTRNAME) &&
|
if( !(form->flags & HTTPPOST_PTRNAME) &&
|
||||||
(form == first_form) ) {
|
(form == first_form) ) {
|
||||||
|
/* 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) */
|
/* copy name (without strdup; possibly contains null characters) */
|
||||||
form->name = memdup(form->name, form->namelength);
|
form->name = memdup(form->name, form->namelength);
|
||||||
if(!form->name) {
|
if(!form->name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user