From 9bfe7d74c0ebaa4b1e538804040d77e194b4e45d Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Mon, 25 Mar 2019 09:07:02 +0100 Subject: [PATCH] windows.cfg: Fixed FP for invalidFunctionArg in second argument of _getcwd(). Reference: https://docs.microsoft.com/en-us/previous-versions/sf98bd4y(v%3Dvs.140) --- cfg/windows.cfg | 3 ++- test/cfg/windows.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cfg/windows.cfg b/cfg/windows.cfg index b4723bbef..2fbcd8691 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -1846,7 +1846,8 @@ - 1: + + 0: diff --git a/test/cfg/windows.cpp b/test/cfg/windows.cpp index 1ddf667a0..c7044cd5a 100644 --- a/test/cfg/windows.cpp +++ b/test/cfg/windows.cpp @@ -8,6 +8,19 @@ // #include +#include +#include + +void invalidFunctionArg__getcwd(char * buffer) +{ + // Passing NULL as the buffer forces getcwd to allocate + // memory for the path, which allows the code to support file paths + // longer than _MAX_PATH, which are supported by NTFS. + if ((buffer = _getcwd(NULL, 0)) == NULL) { + return; + } + free(buffer); +} void validCode() {