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

x509name: fix handling of X509_NAME_{oneline,print_ex}() return value #211

Merged
merged 3 commits into from
Aug 8, 2018

Conversation

rhenium
Copy link
Member

@rhenium rhenium commented Aug 8, 2018

X509_NAME_print_ex() behaves differently depending on the passed flags.
When XN_FLAG_COMPAT is specified, it returns either 1 on success or 0
on error. Otherwise, it returns the byte size written or -1 on error.
This means 0 return is not necessarily an error.

Also, X509_NAME_oneline() return value needs to be checked as it may
fail with a NULL return.

Fixes: #200

Allow string literals containing UTF-8 characters.

(cherry picked from commit 98945c7)
Extract the body into a function in preparation for adding #to_utf8.

Also a potential memory leak is fixed: the GetX509Name() macro can
raise TypeError.

(cherry picked from commit 5896473)
X509_NAME_print_ex() behaves differently depending on the passed flags.
When XN_FLAG_COMPAT is specified, it returns either 1 on success or 0
on error. Otherwise, it returns the byte size written or -1 on error.
This means 0 return is not necessarily an error.

Also, X509_NAME_oneline() return value needs to be checked as it may
fail with a NULL return.

Fixes: ruby#200
@rhenium rhenium merged commit 307db49 into ruby:maint-2.0 Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant