-
Notifications
You must be signed in to change notification settings - Fork 704
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
Check length before reading in stringmatchlen
#1431
Check length before reading in stringmatchlen
#1431
Conversation
When a pattern is not NUL-terminated, stringmatchlen could overrun the end in some cases. Signed-off-by: Thalia Archibald <[email protected]>
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.
Thanks!
This is not a security issue, right? We always call this with null-terminated strings, I believe.
It's still good to remove the assumption about null-terminated strings and never look beyond the last char of the strings.
I count 20 calls in Valkey to |
Thanks! I edited the top comment because we use it as the commit message when squash-merging. |
Thanks for the edit. I would have put the extra context in another comment if I knew it would be in the message. Oh well. |
Fixes four cases where `stringmatchlen` could overrun the pattern if it is not terminated with NUL. These commits are cherry-picked from my [fork](https://github.com/thaliaarchi/antirez-stringmatch) which extracts `stringmatch` as a library and compares it to other projects by antirez which use the same matcher. Signed-off-by: Thalia Archibald <[email protected]>
Fixes four cases where `stringmatchlen` could overrun the pattern if it is not terminated with NUL. These commits are cherry-picked from my [fork](https://github.com/thaliaarchi/antirez-stringmatch) which extracts `stringmatch` as a library and compares it to other projects by antirez which use the same matcher. Signed-off-by: Thalia Archibald <[email protected]>
Fixes four cases where
stringmatchlen
could overrun the pattern if it is not terminated with NUL.These commits are cherry-picked from my fork which extracts
stringmatch
as a library and compares it to other projects by antirez which use the same matcher.