]> granicus.if.org Git - curl/commitdiff
formdata: check for EOF when reading from stdin
authorDaniel Stenberg <daniel@haxx.se>
Thu, 23 Feb 2017 09:41:20 +0000 (10:41 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 23 Feb 2017 09:47:44 +0000 (10:47 +0100)
Reported-by: shachaf@users.noreply.github.com
Fixes #1281

lib/formdata.c

index c12227623dddd2ad0266c7162b7a0d228304bd7a..c214ba28e90eddd337dab77b26c3ab746e3a6ca3 100644 (file)
@@ -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;
             }
           }