View Issue Details

IDProjectCategoryView StatusLast Update
0001417libmicrohttpdHTTPS (TLS)public2008-09-10 22:49
ReporterChristian Grothoff Assigned ToChristian Grothoff  
PrioritynormalSeveritycrashReproducibilityN/A
Status closedResolutionfixed 
Product VersionGit master 
Summary0001417: crazy code using uninitialized variables
DescriptionThis is in gnutls_x509.c (also in the latest GNUtls release):

static int
parse_pkcs7_cert_mem (gnutls_cert ** cert_list, unsigned *ncerts, const
                      void *input_cert, int input_cert_size, int flags)
{
#ifdef ENABLE_PKI
  int i, j, count;
  gnutls_datum_t tmp, tmp2;
  int ret;
  opaque *pcert = NULL;
  size_t pcert_size;
  gnutls_pkcs7_t pkcs7;

  ret = gnutls_pkcs7_init (&pkcs7);
  if (ret < 0)
    {
      gnutls_assert ();
      return ret;
    }

  if (flags & CERT_PEM)
    ret = gnutls_pkcs7_import (pkcs7, &tmp, GNUTLS_X509_FMT_PEM);
  else
    ret = gnutls_pkcs7_import (pkcs7, &tmp, GNUTLS_X509_FMT_DER);


Note that "tmp" is never initialized. Here is how pkcs7_import starts:

int
gnutls_pkcs7_import (gnutls_pkcs7_t pkcs7, const gnutls_datum_t * data,
                     gnutls_x509_crt_fmt_t format)
{
  int result = 0, need_free = 0;
  gnutls_datum_t _data;

  if (pkcs7 == NULL)
    return GNUTLS_E_INVALID_REQUEST;

  _data.data = data->data;
  _data.size = data->size;


It goes downhill from there. What I would like to know is how this is even supposed to work!?!?!?
Additional InformationAnother good question is what "ENABLE_PKI" really adds in terms of features.
TagsNo tags attached.

Activities

Christian Grothoff

2008-08-25 15:12

manager   ~0003669

Nikos wrote:

Please don't remove the code. It is perfectly correct. It seems at some
point the initialization of tmp was removed (or maybe was never commited
correctly?). Anyway I've corrected it and it can now parse pkcs7 structures.

I used openssl-0.9.7c/crypto/pkcs7/t/ff to test.


http://git.savannah.gnu.org/gitweb/?p=gnutls.git;a=commitdiff;h=976565830d853f981ecd749bdb15dd02133ed93b

Christian Grothoff

2008-08-25 15:13

manager   ~0003670

Fixed in 7624.

Issue History

Date Modified Username Field Change
2008-08-24 17:10 Christian Grothoff New Issue
2008-08-25 15:12 Christian Grothoff Note Added: 0003669
2008-08-25 15:13 Christian Grothoff Status new => assigned
2008-08-25 15:13 Christian Grothoff Assigned To => Christian Grothoff
2008-08-25 15:13 Christian Grothoff Status assigned => resolved
2008-08-25 15:13 Christian Grothoff Resolution open => fixed
2008-08-25 15:13 Christian Grothoff Note Added: 0003670
2008-09-10 22:49 Christian Grothoff Status resolved => closed
2013-05-06 12:52 Christian Grothoff Category SSL => HTTPS (SSL)
2024-01-21 13:25 Christian Grothoff Category HTTPS (SSL) => HTTPS (TLS)