-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for integer/buffer overflow CVE-2021-32765
This fix prevents hiredis from trying to allocate more than `SIZE_MAX` bytes, which would result in a buffer overrun. [Full Details](GHSA-hfm9-39pp-55p2)
- Loading branch information
1 parent
d5b4c69
commit 76a7b10
Showing
2 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76a7b10
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.
Hello, this patch surprises me a little:
calloc()
is reasonable and performs the overflow check itself. I'd argue any implementation ofcalloc()
that neglects this check deserves a CVE so that it can be fixed, once, for all applications using that implementation, and applications can skip doing these checks themselves.calloc()
that cannot be fixed, why not put this check into thehi_calloc()
wrapper function? This would save the Redis developers from needing to annotate every call site with this check.Thanks
76a7b10
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.
Hi,
We agree that any sane
calloc
will perform this check itself, but we received a formal report from MSVR who recommended the hardening.Good point, I think the wrapper function is a better place for the logic. I'll make a point to do that before the next release.
Edit: cc @setharnold Branch with refactored logic for reference