lib: replace _tcsncpy/wcsncpy/wcscpy with _s counterparts (Windows)#19589
Closed
vszakats wants to merge 5 commits into
Closed
lib: replace _tcsncpy/wcsncpy/wcscpy with _s counterparts (Windows)#19589vszakats wants to merge 5 commits into
_tcsncpy/wcsncpy/wcscpy with _s counterparts (Windows)#19589vszakats wants to merge 5 commits into
Conversation
3 tasks
_s counterparts (Windows)wcsncpy/wcscpy with their _s counterparts (Windows)
wcsncpy/wcscpy with their _s counterparts (Windows)wcsncpy/wcscpy with their _s counterparts (Windows)
wcsncpy/wcscpy with their _s counterparts (Windows)_tcsncpy/wcsncpy/wcscpy with _s counterparts (Windows)
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Nov 21, 2025
Follow-up to eaa7651 curl#19589
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Nov 21, 2025
Follow-up to eaa7651 curl#19589
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Nov 21, 2025
Follow-up to eaa7651 curl#19589 Closes curl#19641
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace:
_tcsncpy()with_tcsncpy_s().wcsncpy()withwcsncpy_s().wcscpy()withwcscpy_s().Use of the pre-existing functions were safe. This patch aims to use the
recommended Windows CRT functions. Handle errors returned by them. Also
to avoid the compiler warnings silenced via
_CRT_SECURE_NO_WARNINGS:Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/strncpy-strncpy-l-wcsncpy-wcsncpy-l-mbsncpy-mbsncpy-l
https://learn.microsoft.com/cpp/c-runtime-library/reference/strncpy-s-strncpy-s-l-wcsncpy-s-wcsncpy-s-l-mbsncpy-s-mbsncpy-s-l
https://learn.microsoft.com/cpp/c-runtime-library/security-features-in-the-crt
Cherry-picked from #19581 (in part)