Permalink
Browse files

AddFormData: prevent only directories from being posted

Commit f4cc54c (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
  • Loading branch information...
1 parent fadf33c commit 26eaa8383001219e7cd14a153dff95ea9274be6e @bagder bagder committed Mar 4, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/formdata.c
View
@@ -831,7 +831,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;

0 comments on commit 26eaa83

Please sign in to comment.