Skip to content
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

Check ASN1_item_ndef_i2d() return value. #14308

Closed
wants to merge 1 commit into from
Closed

Conversation

@kaduk
Copy link
Contributor

@kaduk kaduk commented Feb 24, 2021

Return an error instead of trying to malloc a negative number.
The other usage in this file already had a similar check, and the caller
should have put an entry on the error stack already.

Note that we only check the initial calls to obtain the encoded length,
and assume that the follow-up call to actually encode to the allocated
storage will succeed if the first one did.

Fixes: #14177

Return an error instead of trying to malloc a negative number.
The other usage in this file already had a similar check, and the caller
should have put an entry on the error stack already.

Note that we only check the initial calls to obtain the encoded length,
and assume that the follow-up call to actually encode to the allocated
storage will succeed if the first one did.

Fixes: #14177
Copy link
Contributor

@slontis slontis left a comment

Looks like a good idea to do this..

@openssl-machine
Copy link

@openssl-machine openssl-machine commented Feb 26, 2021

This pull request is ready to merge

openssl-machine pushed a commit that referenced this pull request Feb 26, 2021
Return an error instead of trying to malloc a negative number.
The other usage in this file already had a similar check, and the caller
should have put an entry on the error stack already.

Note that we only check the initial calls to obtain the encoded length,
and assume that the follow-up call to actually encode to the allocated
storage will succeed if the first one did.

Fixes: #14177

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from #14308)
openssl-machine pushed a commit that referenced this pull request Feb 26, 2021
Return an error instead of trying to malloc a negative number.
The other usage in this file already had a similar check, and the caller
should have put an entry on the error stack already.

Note that we only check the initial calls to obtain the encoded length,
and assume that the follow-up call to actually encode to the allocated
storage will succeed if the first one did.

Fixes: #14177

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from #14308)

(cherry picked from commit 90b4247)
@kaduk
Copy link
Contributor Author

@kaduk kaduk commented Feb 26, 2021

Merged to master and 1.1.1; closing.

@kaduk kaduk closed this Feb 26, 2021
@sthagen sthagen mentioned this pull request Feb 27, 2021
0 of 2 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants