Piotr Caban : msvcrt: Always set fd to -1 in _sopen_s on failure.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 10 16:17:35 CDT 2014


Module: wine
Branch: master
Commit: a5665693053b15a148407481c603a848fa183726
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a5665693053b15a148407481c603a848fa183726

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Jul 10 15:12:12 2014 +0200

msvcrt: Always set fd to -1 in _sopen_s on failure.

---

 dlls/msvcrt/file.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 8b12ae9..0e5deba 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2185,6 +2185,9 @@ int CDECL MSVCRT__sopen_s( int *fd, const char *path, int oflags, int shflags, i
     MSVCRT_wchar_t *pathW;
     int ret;
 
+    if (!MSVCRT_CHECK_PMT(fd != NULL))
+        return MSVCRT_EINVAL;
+    *fd = -1;
     if(!MSVCRT_CHECK_PMT(path && (pathW = msvcrt_wstrdupa(path))))
         return MSVCRT_EINVAL;
 




More information about the wine-cvs mailing list