-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
CVE-2020-7105: Abort if malloc() was unsuccessful #752
Conversation
This is to address #747 |
Is there any advantage of crashing via abort vs crashing via segfault? |
The segfault might be exploitable, and the |
I think a better way to fix this is to abstract out the handling function to header files. For example: |
Ah, good idea. I was not aware of that particular idiom, thanks. |
78cec25
to
dcc7cea
Compare
Something like this? :) |
lgtm but I am not the owner |
Perhaps just wrap the entire allocation in a macro/function? |
This could work. But:
|
|
That's what I would suggest as well. Given that we often do handle a What about If we're all good with that direction I'm happy to formalize (and actually test) the changes. edit for correct links: |
FYI this links to the "New PR" page and not the PR itself. Did you forget to push it? I don't see the branch in your fork... :) |
Apparently I can't link things properly 😄 |
Thanks; nice work. I suppose the other approach might be to emulate what Redis' |
I like that strategy as well, but we probably need two versions because there are a bunch of places where OOM is handled in a non-fatal way. @mnunberg let us know if this strategy seems reasonable. |
As an alternative what do people think about getting #638 merged first? That has some good stuff in it in addition to the malloc NULL checks. In particular the the |
lgtm, the only conflict is in if (NULL != (dup = malloc(sizeof(*dup))))
memcpy(dup, src, sizeof(*dup)); |
I'd quite very like this one (or something similar) merged first as I am trying to ensure I can cherry-pick a minimal patch for older and already-shipped versions of hiredis, hence trying to reduce the number of changes. It would be difficult for me to ship out #638's wide-reaching changes in a safe and confident manner (and might even be difficult to backport in a pure code sesne as it changes quite a lot). |
dcc7cea
to
3e2ddf9
Compare
Re #638 I'm not a fan of mindlessly checking for NULL so much and so explicitly that it makes the actual code hard to read. I think that PR has too much boilerplate, though I do appreciate what he's trying to do over there. @michael-grunder I'm in favor of a prefixed malloc, maybe |
Closing in favor of #754, please redirect all bikeshedding over there. |
Will a new release/tag be issued (0.15.0?) since this addresses a CVE? |
No description provided.