aboutsummaryrefslogtreecommitdiff
path: root/lib/formdata.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-02-23 10:41:20 +0100
committerng0 <ng0@infotropique.org>2017-08-22 15:19:41 +0000
commit943680dacd8117abb828581cfee99cc7c221edd5 (patch)
tree010df15099ddb4c12d0007956bc75524a5241e8d /lib/formdata.c
parentd543e32512509988f9a3ea50fbf028ec2bd3ead1 (diff)
downloadgnurl-943680dacd8117abb828581cfee99cc7c221edd5.tar.gz
gnurl-943680dacd8117abb828581cfee99cc7c221edd5.tar.bz2
gnurl-943680dacd8117abb828581cfee99cc7c221edd5.zip
formdata: check for EOF when reading from stdin
Reported-by: shachaf@users.noreply.github.com Fixes #1281
Diffstat (limited to 'lib/formdata.c')
-rw-r--r--lib/formdata.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index c12227623..c214ba28e 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -1332,7 +1332,7 @@ CURLcode Curl_getformdata(struct Curl_easy *data,
char buffer[512];
while((nread = fread(buffer, 1, sizeof(buffer), fileread)) != 0) {
result = AddFormData(&form, FORM_CONTENT, buffer, nread, &size);
- if(result)
+ if(result || feof(fileread) || ferror(fileread))
break;
}
}