Skip to content

change string_starts_with to use memcmp - #419

Open
basiccube wants to merge 1 commit into
ButterscotchRunner:mainfrom
basiccube:string-starts-with-fix-2
Open

change string_starts_with to use memcmp#419
basiccube wants to merge 1 commit into
ButterscotchRunner:mainfrom
basiccube:string-starts-with-fix-2

Conversation

@basiccube

Copy link
Copy Markdown
Contributor

#392 changed string_starts_with to use strcmp instead of memcmp to fix a crash when comparing a substring that's longer than the specified string
the problem is, with strcmp, it compares both strings in their entirety rather than just the length of the second string, so something like string_starts_with("Hello World!", "Hello"); wouldn't return true

this basically reverts it back to using memcmp while adding an additional check for the substring being longer than the string

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.

1 participant