-
Notifications
You must be signed in to change notification settings - Fork 50
util: fix deserialize buffer overflow #74
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
Conversation
selvanair
left a comment
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.
Here is a simpler version which I hope is correct :)
https://gist.github.com/selvanair/e541faacac36a40f1066b091e87084de
lib/pkcs11h-util.c
Outdated
| else { | ||
| if (t != NULL) { | ||
| if (n+1 > *max) { | ||
| s++; |
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.
If t == NULL, this can advance past the end of s.
lib/pkcs11h-util.c
Outdated
| s++; | ||
|
|
||
| if (t != NULL && n < m) { | ||
| if (b2 = _ctoi(*s) == -1) { |
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.
should be ((b2 = _ctoi(*s)) == -1)
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.
yeah!!! thank you for finding it.
lib/pkcs11h-util.c
Outdated
| t++; | ||
| } | ||
| n++; | ||
| s++; |
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.
This can advance past the end if t is NULL or n >= m.
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.
thank you for reviewing... bummer I wanted to avoid logic when t == NULL...
Missing check for source file increment. Reported-by: Aarnav Bos <[email protected]>
|
@selvanair thank you so much for the review, I've modified the implementation to use macros, I hope now all is ok. |
|
Looks good to me if returning a wrong value of |
|
@selvanair @alonbl the fix also looks good from the fuzzing side! |
|
Thank you all! |
Missing check for source file increment.
Reported-by: Aarnav Bos [email protected]