Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable CRT Warnings and fix them #1269

Merged

Conversation

charles-lunarg
Copy link
Collaborator

CRT_SECURE_NO_WARNINGS disables warnings from using strcpy & strcat as well as strncpy and strncat. This isn't likely a huge concern, but the more warnings the better typically.

This commit introduces loader_strncpy and loader_strncat which are platform generic versions. C11 added strncpy_s and strncat_s which are analogs to the win32 functions. But because this is a C99 project, these functions are not used.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build queued with queue ID 16112.

Copy link
Collaborator

@MarkY-LunarG MarkY-LunarG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2109 passed.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build queued with queue ID 17517.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2114 running.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2114 failed.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build queued with queue ID 18008.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2115 running.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2115 passed.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build queued with queue ID 19270.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2118 running.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build queued with queue ID 19299.

Fixes the many uses of strncpy and strncat to use versions of the functions
which the CRT approves of. This means adding the length of the destination
string as a parameter.

The function loader_platform_combine_path was removed and the single use of
it was replaced with a call to snprinf, which achieves the same goal.

There are a few other functions that the CRT warns about, like fopen and
the wide char version of strcpy. These were also replaced with the 'safe'
functions.
@ci-tester-lunarg
Copy link

CI Vulkan-Loader build queued with queue ID 19306.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2120 running.

@ci-tester-lunarg
Copy link

CI Vulkan-Loader build # 2120 passed.

@charles-lunarg charles-lunarg merged commit acff433 into KhronosGroup:main Aug 7, 2023
37 checks passed
@charles-lunarg charles-lunarg deleted the redo_remove_no_crt_warnings branch August 7, 2023 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants