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 use-after-free #3947
Fix use-after-free #3947
Conversation
@@ -84,7 +85,8 @@ int opt_rand(int opt) | |||
return loadfiles(opt_arg()); | |||
break; | |||
case OPT_R_WRITERAND: | |||
save_rand_file = opt_arg(); | |||
OPENSSL_free(save_rand_file); |
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 there is situation when OPENSSL_free would be required here, then it would be appropriate to save_rand_file = NULL
after line 69. Otherwise we would be looking at double-free. No?
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.
it's only called on app exit so I don't think so, but it is safer to do so. updated commit pushed
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.
But you can start openssl without arguments and invoke "apps" or one several times, right?
Also fix a RANDerr call.
Yes but it’s only called on exit as part of process cleanup. But maybe I’m wrong.
|
Also fix a RANDerr call. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3947)
merged with 5435ba0, thanks! |
Also fix a RANDerr call.
Fixes #3946