1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

formadd: reject trying to read a directory where a file is expected

Bug: http://curl.haxx.se/mail/archive-2013-01/0017.html
Reported by: Ulrich Doehner
This commit is contained in:
Daniel Stenberg 2013-01-19 23:08:12 +01:00
parent 34ae007d4d
commit f4cc54cb47

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -830,9 +830,10 @@ static CURLcode AddFormData(struct FormData **formp,
file */ file */
if(!strequal("-", newform->line)) { if(!strequal("-", newform->line)) {
struct_stat file; struct_stat file;
if(!stat(newform->line, &file)) { if(!stat(newform->line, &file) && S_ISREG(file.st_mode))
*size += file.st_size; *size += file.st_size;
} else
return CURLE_BAD_FUNCTION_ARGUMENT;
} }
} }
} }