Skip to content

Fix for parsing a certificate with an extension attribute with a NULL-value#39

Open
mwpnl wants to merge 2 commits into
Southern:masterfrom
mwpnl:master
Open

Fix for parsing a certificate with an extension attribute with a NULL-value#39
mwpnl wants to merge 2 commits into
Southern:masterfrom
mwpnl:master

Conversation

@mwpnl

@mwpnl mwpnl commented Aug 21, 2016

Copy link
Copy Markdown

This pull request should resolve #37 by checking if a extension contains NULL data. When implemented, the extension is still given as output, but with an empty value (\0).

mwpnl added 2 commits August 21, 2016 15:28
…at would break processing the rest of the certificate.
Comment thread src/x509.cc
BIO_free(ext_bio);
if (bptr->data == NULL){
BIO_free(ext_bio);
data="";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

free(data) :)

@yorkie

yorkie commented Aug 21, 2016

Copy link
Copy Markdown
Collaborator

By the way, please follow the coding style at first.

@Southern

Copy link
Copy Markdown
Owner

@mwpnl Should @yorkie or I make the changes that were suggested so that this can be merged in? Been a little over 2 weeks with no response.

@Southern Southern left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the lack of activity in this PR, I'm starting to believe this was a case of a certificate being malformed or some other factor than this specific module and was solved by correcting that issue.

If we do decide to make this change, I would use the reverse logic and only allocate/copy/trim if bptr->data != NULL. I'm pretty sure that's what @yorkie was eluding to with https://github.com/Southern/node-x509/pull/39/files#r75600803.

Comment thread src/x509.cc
data = trim(data, bptr->length);

BIO_free(ext_bio);
if (bptr->data == NULL){

@Southern Southern Oct 3, 2016

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the better option would be to not run the allocation or anything that deals with data unless bptr->data != NULL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SegFault on certain certificates

3 participants