|
|
048e7c |
From f4ae40a0e8a35d18a7b8560980b9408d7b06ba8c Mon Sep 17 00:00:00 2001
|
|
|
048e7c |
From: Daniel Stenberg <daniel@haxx.se>
|
|
|
048e7c |
Date: Mon, 4 Mar 2013 15:20:22 +0100
|
|
|
048e7c |
Subject: [PATCH] AddFormData: prevent only directories from being posted
|
|
|
048e7c |
MIME-Version: 1.0
|
|
|
048e7c |
Content-Type: text/plain; charset=UTF-8
|
|
|
048e7c |
Content-Transfer-Encoding: 8bit
|
|
|
048e7c |
|
|
|
048e7c |
Commit f4cc54cb4746ae5a6d (shipped as part of the 7.29.0 release) was a
|
|
|
048e7c |
bug fix that introduced a regression in that while trying to avoid
|
|
|
048e7c |
allowing directory names, it also forbade "special" files like character
|
|
|
048e7c |
devices and more. like "/dev/null" as was used by Oliver who reported
|
|
|
048e7c |
this regression.
|
|
|
048e7c |
|
|
|
048e7c |
Reported by: Oliver Gondža
|
|
|
048e7c |
Bug: http://curl.haxx.se/mail/archive-2013-02/0040.html
|
|
|
048e7c |
|
|
|
048e7c |
Upstream-commit: 26eaa8383001219e7cd14a153dff95ea9274be6e
|
|
|
048e7c |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
048e7c |
---
|
|
|
048e7c |
lib/formdata.c | 2 +-
|
|
|
048e7c |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
048e7c |
|
|
|
048e7c |
diff --git a/lib/formdata.c b/lib/formdata.c
|
|
|
048e7c |
index 0da6de3..28f9a32 100644
|
|
|
048e7c |
--- a/lib/formdata.c
|
|
|
048e7c |
+++ b/lib/formdata.c
|
|
|
048e7c |
@@ -796,7 +796,7 @@ static CURLcode AddFormData(struct FormData **formp,
|
|
|
048e7c |
file */
|
|
|
048e7c |
if(!strequal("-", newform->line)) {
|
|
|
048e7c |
struct_stat file;
|
|
|
048e7c |
- if(!stat(newform->line, &file) && S_ISREG(file.st_mode))
|
|
|
048e7c |
+ if(!stat(newform->line, &file) && !S_ISDIR(file.st_mode))
|
|
|
048e7c |
*size += file.st_size;
|
|
|
048e7c |
else
|
|
|
048e7c |
return CURLE_BAD_FUNCTION_ARGUMENT;
|
|
|
048e7c |
--
|
|
|
048e7c |
2.20.1
|
|
|
048e7c |
|