[gnutls-dev] [PATCH] Fixing OpenPGP keyring import (again)

Ludovic Courtès ludovic.courtes at laas.fr
Tue May 22 13:31:38 CEST 2007


Timo Schulz <twoaday at gmx.net> writes:

> Ludovic Courtes wrote:

>>   err = cdk_stream_tmp_from_mem (data->data, data->size, &input);
>>   if (!err)
>>     err = cdk_stream_set_armor_flag (input, 0);
>>   if (!err)
>>     err = cdk_keydb_new_from_stream (&keyring->db, 0, input);  
>>   if (err)
>>     {
>>       cdk_stream_close (input);
>>       gnutls_assert ();
>>     }
>> That won't work if `cdk_stream_tmp_from_mem ()' returns an error.
> Why? input is set to NULL in the function and thus cdk_stream_close
> does nothing because the param is NULL.

`cdk_keydb_new_from_stream ()' does not always initialize INPUT to NULL
on error, at least not in the OpenCDK currently available in HEAD:

  cdk_keydb_new_from_stream (cdk_keydb_hd_t *r_hd, int secret,
                             cdk_stream_t in)
    cdk_keydb_hd_t hd;

    if (!r_hd)
      return CDK_Inv_Value;
And `cdk_stream_close ()' returns an error if STREAM is NULL:

  cdk_stream_close (cdk_stream_t s)
    struct stream_filter_s *f, *f2;
    cdk_error_t rc;

    if (!s)
      return CDK_Inv_Value;

Well, we don't check its return value...

> IMHO the ChangeLog entries are generated from the CVS commit logs.

It turns out that they are not automatically generated.


More information about the Gnutls-devel mailing list