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

Fix double free in cert query #658

Merged

Conversation

ArnoStiefvater
Copy link
Member

What:

Double free in cert_query.
ksba_cert_get_image does not return a copy but only a pointer to the image. Do not free it with gnutls_free. It will get freed with ksba_cert_release when nasl_cert_close is called.

Why:

Fix #480.

How:

Test with some VT

if(description) {
  script_oid("1.2.3");
  exit(0);
}

cert = "<Some BER encoded certificate>";
if( ! cert = cert_open( cert) )
  display( "Error opening cert!" );

size = cert_query( cert, "key-size" ); 
display(size);

cert_close( cert );
exit(0);

Error double free or corruption (!prev) will be gone after applied PR.

Checklist:

ksba_cert_get_image does not return a copy but
only a pointer to the image.
Do not free it with gnutls_free(). It will get
freed with ksba_cert_release when nasl_cert_close
is called.
@jjnicola jjnicola merged commit 33f4cde into greenbone:openvas-20.08 Feb 16, 2021
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.

2 participants