mainGnuTLS - Support: sr #108563, API functions with output...

 
 

sr #108563: API functions with output arguments should allow null values

Submitter:  Eduardo Lima <elima>
Submitted:  Tue 06 May 2014 08:57:44 AM UTC
   
 
Category:  Core library Priority:  5 - Normal
Severity:  3 - Normal Status:  Need Info
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 07 Mar 2015 10:45:28 PM UTC, comment #5: 

The issue tracker is being moved in gitlab; if the issue is not resolved in the latest gnutls version please open a ticket at:
https://gitlab.com/gnutls/gnutls/issues

Nikos Mavrogiannopoulos <nmav>
Group administrator
Mon 12 May 2014 08:52:34 AM UTC, comment #4: 

Thanks for checking that, a patch would be nice.

Nikos Mavrogiannopoulos <nmav>
Group administrator
Mon 12 May 2014 08:06:58 AM UTC, comment #3: 

Looking at the upstream repo I notice that there are other export methods that do not check nullness of out args: gnutls_pubkey_export_rsa_raw, gnutls_pubkey_export_dsa_raw, gnutls_dh_params_export_raw, and possibly others; so this issue is still valid.

I can provide patches for these methods if needed.

Eduardo Lima <elima>
Mon 12 May 2014 07:48:42 AM UTC, comment #2: 


> To which version of gnutls does your comment refer to?


My comment refers to version 3.2.13 from Debian jessie. Didn't check upstream though, my bad.

> The latest version allows for null parameters in the function that you mention.


Great!

> In any case it is quite simple to provide a patch to improve documentation or fix the functions that you're interested to.


Agree, though it is normally a good idea to wait for feedback before start working in a patch, this case being a good example :).

Thank you and cheers

Eduardo Lima <elima>
Sat 10 May 2014 08:48:42 AM UTC, comment #1: 

Hello,
 To which version of gnutls does your comment refer to? The latest version allows for null parameters in the function that you mention. In any case it is quite simple to provide a patch to improve documentation or fix the functions that you're interested to.

Nikos Mavrogiannopoulos <nmav>
Group administrator
Tue 06 May 2014 08:57:44 AM UTC, original submission:  

The "export" family of functions in GnuTLS API expect non-null values for their gnutls_datum_t out arguments (e.g gnutls_x509_privkey_export_rsa_raw()), otherwise it crashes without checking. This is dangerous and non-efficient at the same time:

Dangerous because it is (arguably) a common practice in API with out arguments to pass NULL for values that are not of interest. Also, such expectation is not documented or asserted internaly.

Non-efficient because API users wanting to retrieve just a particular parameter would have to pass valid pointers to all arguments, which then will be allocated by GnuTLS, only to be freed immediately.

My suggestion is to change the behavior of these functions so that out arguments for which a NULL argument was passed are not allocated and simply ignored.
Or, at least, change the documentation to cleary state that non-NULL values are expected, and add sentinels internally to avoid the crashes.

Eduardo Lima <elima>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nmav (Posted a comment)
  • -email is unavailable- added by elima (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-07 nmav Open/ClosedOpen Closed
    2014-05-10 nmav StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code