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

fix(developer): prevent buffer overrun in u16tok #11910

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mcdurdin
Copy link
Member

@mcdurdin mcdurdin commented Jul 2, 2024

Relates-to: #11814
See-also: #11894

@keymanapp-test-bot skip

@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Jul 2, 2024

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

@@ -243,7 +243,7 @@ KMX_WCHAR * u16tok(KMX_WCHAR *p, const KMX_WCHAR ch, KMX_WCHAR **ctx) {
else {
*ctx = NULL;
}
return p;
return *p ? p : NULL;
Copy link
Member Author

Choose a reason for hiding this comment

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

Prevents delimiters at end of string from returning an empty string. (Matching strtok behaviour)

@@ -259,13 +259,13 @@ KMX_WCHAR * u16tok(KMX_WCHAR* p, const KMX_WCHAR* delim, KMX_WCHAR** ctx) {
if (*q) {
*q = 0;
q++;
while (u16chr(delim, *q)) q++;
while (*q && u16chr(delim, *q)) q++;
Copy link
Member Author

Choose a reason for hiding this comment

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

Prevent buffer overrun

SabineSIL added a commit that referenced this pull request Jul 3, 2024
markcsinclair added a commit that referenced this pull request Jul 4, 2024
Merge branch 'fix/developer/11814-kmx_u16-buffer-overrun' into fix/developer/correct-use-of-u16chr-when-second-parameter-could-be-null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

1 participant