Windows crash in ctime_r()
authorMichael Schoberg (mschoberg) <mschoberg@micron.com>
Mon, 16 May 2016 21:50:19 +0000 (21:50 +0000)
committerJens Axboe <axboe@fb.com>
Tue, 17 May 2016 01:25:48 +0000 (19:25 -0600)
commit15a0c8ee4e1a5434075ebc2c9f48e96e5e892196
tree2b88814fb63deae85ee6d0afba7e3b251f1c7cba
parent8c5e96a4ee7004b2982b5d5247ecea1cb96bccb7
Windows crash in ctime_r()

I think I found an issue in os\windows\posix.c that results in a FIO
crash (on Windows.)  I'm including a patch that resolves the crash for
us, but includes another (optional) fix.

Crash issue:  possix.c  - ctime_r() will reference a negative array
index on Sunday.  SYSTEMTIME states the days of the week as: "0=Sunday,
.. , 6=Saturday."  The "fix" can likely be dialed back to safely assume
the days/months will adhere to how they're documented.

Optional - StringCchPrintfA() calls should allow for the string plus a
NULL character.  Instead, the value getting passed in is for the entire
string size.

os/windows/posix.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Signed-off-by: Jens Axboe <axboe@fb.com>
os/windows/posix.c