-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
base: master
Are you sure you want to change the base?
Conversation
User Test ResultsTest 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; |
There was a problem hiding this comment.
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++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prevent buffer overrun
Merge branch 'fix/developer/11814-kmx_u16-buffer-overrun' into fix/developer/correct-use-of-u16chr-when-second-parameter-could-be-null
Relates-to: #11814
See-also: #11894
@keymanapp-test-bot skip