-
Notifications
You must be signed in to change notification settings - Fork 794
Fix unsound OCSP find_status handling of optional next_update field #2517
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 unsound OCSP find_status handling of optional next_update field #2517
Conversation
|
I don't understand the warning in the MSRV builder. We have an |
6aa5292 to
4eafa15
Compare
botovq
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.
The code itself reads fine modulo one thing that could be better if we didn't support ancient library versions.
(I really do not like Claude's overly repetitive and verbose commenting style.)
|
You should have seen how bad the comments were before I trimmed them down 🙃. (I'm ultimately accountable for anything in this PR, so really it's better that I think of it as my comments are bad.) |
4eafa15 to
bc3c83f
Compare
The OCSP find_status function was unsound because it treated next_update as always present, even though it's optional per RFC 6960. When absent, the null pointer from FFI was passed to from_ptr which doesn't check for null, causing undefined behavior. Fixed by using from_const_ptr_opt to safely handle the null case. Added next_update() method returning Option<&Asn1GeneralizedTimeRef> and deprecated the existing field which now contains a sentinel max time value (99991231235959Z) for backwards compatibility. Fixes rust-openssl#2516
bc3c83f to
cc26867
Compare
botovq
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.
Looks much better to me. One suggestion - feel free to ignore.
|
I'll plan to do a release with this fix tomorrow. |
The OCSP find_status function was unsound because it treated next_update as always present, even though it's optional per RFC 6960. When absent, the null pointer from FFI was passed to from_ptr which doesn't check for null, causing undefined behavior.
Fixed by using from_const_ptr_opt to safely handle the null case. Added next_update() method returning Option<&Asn1GeneralizedTimeRef> and deprecated the existing field which now contains a sentinel max time value (99991231235959Z) for backwards compatibility.
Fixes #2516