Skip to content

strncmp length correction#1729

Merged
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
1640max:patch-1
Jun 16, 2025
Merged

strncmp length correction#1729
charles-lunarg merged 1 commit into
KhronosGroup:mainfrom
1640max:patch-1

Conversation

@1640max

@1640max 1640max commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

Double quotes in cJSON output were removed at bca23b3

They were also removed from those string literals, however the third strncmp's argument left unchanged, making the function to check beyond the string.

Double quotes in cJSON output were removed at bca23b3

They were also removed from those string literals, however the third `strncmp`'s argument left unchanged, making the function to check beyond the string.
@ci-tester-lunarg

Copy link
Copy Markdown

Author 1640max not on autobuild list. Waiting for curator authorization before starting CI build.

1 similar comment
@ci-tester-lunarg

Copy link
Copy Markdown

Author 1640max not on autobuild list. Waiting for curator authorization before starting CI build.

@CLAassistant

CLAassistant commented Jun 16, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@charles-lunarg charles-lunarg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for catching this! How did you find it if I may ask?

I can guess why I didn't, the tests don't write intentionally wrong arch strings so strncmp always returned before reading garbage.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build queued with queue ID 465912.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3081 running.

@ci-tester-lunarg

Copy link
Copy Markdown

CI Vulkan-Loader build # 3081 passed.

@charles-lunarg charles-lunarg merged commit 7ef1581 into KhronosGroup:main Jun 16, 2025
44 checks passed
@1640max 1640max deleted the patch-1 branch June 17, 2025 08:27
@1640max

1640max commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

I was trying a niche-specific code analyser—nothing noteworthy, to be honest.

I just realised that strncmp wouldn't actually reach the garbage since it never reads after \0. And if we're talking about intentionally wrong strings, it might make more sense to use 3 as the third argument instead.

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.

4 participants