diff options
author | Sven Gothel <[email protected]> | 2015-08-20 22:41:33 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-20 22:41:33 +0200 |
commit | 07fb56cdd2ce6a74b2874cc6131bc2fd65f0887b (patch) | |
tree | 1c74ab10fab4a06d9abe1ec8093d1e2891ca90ce /src/newt/native | |
parent | 0b9247c1cfcfcea7c2657f828f804081f9ad5dc7 (diff) |
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)
Diffstat (limited to 'src/newt/native')
-rw-r--r-- | src/newt/native/WindowsEDID.c | 10 |
1 files changed, 8 insertions, 2 deletions
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; + } } } } |