Blob Blame Raw
From f4ae40a0e8a35d18a7b8560980b9408d7b06ba8c Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 4 Mar 2013 15:20:22 +0100
Subject: [PATCH] AddFormData: prevent only directories from being posted
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Commit f4cc54cb4746ae5a6d (shipped as part of the 7.29.0 release) was a
bug fix that introduced a regression in that while trying to avoid
allowing directory names, it also forbade "special" files like character
devices and more. like "/dev/null" as was used by Oliver who reported
this regression.

Reported by: Oliver Gond┼ża
Bug: http://curl.haxx.se/mail/archive-2013-02/0040.html

Upstream-commit: 26eaa8383001219e7cd14a153dff95ea9274be6e
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 lib/formdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/formdata.c b/lib/formdata.c
index 0da6de3..28f9a32 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -796,7 +796,7 @@ static CURLcode AddFormData(struct FormData **formp,
          file */
       if(!strequal("-", newform->line)) {
         struct_stat file;
-        if(!stat(newform->line, &file) && S_ISREG(file.st_mode))
+        if(!stat(newform->line, &file) && !S_ISDIR(file.st_mode))
           *size += file.st_size;
         else
           return CURLE_BAD_FUNCTION_ARGUMENT;
-- 
2.20.1