[CDRIVER-43] avoid NULL-deref (gridfs_store_stream_init API change) Created: 17/Feb/11  Updated: 03/May/17  Resolved: 17/Feb/11

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Jim Meyering Assignee: Kyle Banker
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

latest from git, Fedora 14, x86_64


Attachments: File 0002-avoid-NULL-deref-gridfs_store_stream_init-API-change.patch    
Issue Links:
Duplicate
duplicates CDRIVER-45 unchecked malloc and realloc in gridf... Closed
is duplicated by CDRIVER-44 use strdup in place of malloc+strcpy Closed
Backwards Compatibility: Minor Change

 Description   

There are two unchecked malloc calls in the void-typed gridfs_store_stream_init function.
To handle the possibility of NULL return, the function must return non-void. I chose "int"
in the attached patch.

Also, it's cleaner to use "strdup" rather than the combination of malloc and strcpy.



 Comments   
Comment by Kyle Banker [ 17/Feb/11 ]

I went ahead and linked this to the more specific cases you opened.

Comment by Kyle Banker [ 17/Feb/11 ]

Thanks. I'll commit fixes for these today and will be changing the API somewhat. gridfs_store_stream_init is still a prototype at this point.

Generated at Wed Feb 07 21:08:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.