diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-11-14 16:26:39 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-11-14 16:26:39 +0000 |
commit | 2249c12a3c2737e50d81962040dd36990aa16600 (patch) | |
tree | a3eb562f69081281d803908af2213de904aba2d7 /lib/formdata.c | |
parent | b4ac9cd02c8142e671e903c93e5a0b63a80c31d1 (diff) | |
download | curl-2249c12a3c2737e50d81962040dd36990aa16600.tar.gz |
fix an OOM problem detected by Jim Meyering
Diffstat (limited to 'lib/formdata.c')
-rw-r--r-- | lib/formdata.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/formdata.c b/lib/formdata.c index e035271b3..a370e65a4 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -1100,7 +1100,7 @@ static char *strippath(const char *fullfile) free(filename); /* free temporary buffer */ - return base; /* returns an allocated string! */ + return base; /* returns an allocated string or NULL ! */ } /* @@ -1207,8 +1207,12 @@ CURLcode Curl_getFormData(struct FormData **finalform, if(post->more) { /* if multiple-file */ - char *filebasename= - (!file->showfilename)?strippath(file->contents):NULL; + char *filebasename= NULL; + if(!file->showfilename) { + filebasename = strippath(file->contents); + if(!filebasename) + return CURLE_OUT_OF_MEMORY; + } result = AddFormDataf(&form, &size, "\r\n--%s\r\nContent-Disposition: " |