From 07fb56cdd2ce6a74b2874cc6131bc2fd65f0887b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 20 Aug 2015 22:41:33 +0200 Subject: Bug 1196: Fix Unresolved strncpy_s (MSVCRT) on WinXP Unresolved strncpy_s (MSVCRT) on WinXP, as shown w/ dependency walker (red module, red unresolved line). Mapped: _tcsncpy_s -> strncpy_s (!UNICODE). On WinXP MSVCRT has no strncpy_s. _tcsncpy_s(sOut, sOutLen, s, len) -> bound-check + _tcsncpy(sOut, s, len) --- src/newt/native/WindowsEDID.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/newt/native/WindowsEDID.c') diff --git a/src/newt/native/WindowsEDID.c b/src/newt/native/WindowsEDID.c index d84773dc6..5fc410a91 100644 --- a/src/newt/native/WindowsEDID.c +++ b/src/newt/native/WindowsEDID.c @@ -144,8 +144,14 @@ static _TCHAR* Get2ndSlashBlock(const _TCHAR* sIn, _TCHAR* sOut, size_t sOutLen) size_t len = t - s; if( len > 0 ) { if( sOutLen >= len ) { - _tcsncpy_s(sOut, sOutLen, s, len); - return sOut; + // Bug 1196: Unresolved strncpy_s (MSVCRT) on WinXP. + // Mapped: _tcsncpy_s -> strncpy_s (!UNICODE). + // On WinXP MSVCRT has no strncpy_s. + // _tcsncpy_s(sOut, sOutLen, s, len); + if( len <= sOutLen-1 ) { + _tcsncpy(sOut, s, len); + return sOut; + } } } } -- cgit v1.2.3