Improve sshbuf defensive measures#287
Closed
stoeckmann wants to merge 2 commits into
Closed
Conversation
This situation cannot be reached currently, so it should be a purely defensive measure.
If recallocarray fails in sshbuf_reset, then it could happen that SSHBUF_SIZE_INIT bytes are not available, which would lead to an out of boundary access with explicit_bzero. Check return value of sshbuf_check_sanity to comply with other sshbuf functions and gracefully handle failed re-allocation.
djmdjm
reviewed
Apr 4, 2022
| (r = sshbuf_check_sanity(parent)) != 0) | ||
| return r; | ||
| if (child->parent != NULL) | ||
| child->parent->refcount--; |
Contributor
There was a problem hiding this comment.
I don't think it makes sense for a child buffer to be "re-parented".
IMO we it would be better to explicitly disallow this, e.g.
if (child->parent != NULL && child->parent != parent)
return SSH_ERR_INTERNAL_ERROR;
Author
There was a problem hiding this comment.
Yes, in that case it makes sense to treat it as internal error.
Contributor
|
Thanks - these have been applied and will be in OpenSSH 9.1 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shoutout to @c3h2_ctf