On Sun, Aug 26, 2012 at 4:34 AM, Francesco Vollero <[email protected]> wrote:
> Hi Todd,
>
> On Sun, Aug 26, 2012 at 6:17 AM, Todd Loeber <[email protected]> wrote:
>> Bug) In file curl_action.c, do_get_post_url uses strdup to copy
>> chunk.data, truncating binary blob content during download.
>>
>> I confirmed that returning chunk.data and header_chunk.data (instead
>> of strduping and freeing them) allows retrieval of binary data and
>> incidentally avoids an unnecessary copy.  The caller is already
>> responsible for freeing the output parameters.
>>
>> If libdeltacloud is still alive, it would be nice to have
>> do_get_post_url fixed so binary blobs can be downloaded.  And also,
>> some enhancements!
>>
>
> the libdeltacloud project is not currently maintained, but we would be
> more than pleased to see that libdeltacloud keep gaining some
> interest, with some new "fresh" patch, so why not help us to keep this
> project alive? :) :) :)

That's actually not strictly true.  I do still maintain it, though I
am not actively working on it.  Any patches to improve it would
definitely be welcome.

As far as this particular issue is concerned, yeah, I see the problem
with using strdup.  However, I don't think we can just remove the
strdup().  I'm pretty sure I wrote it that way for a reason, though I
honestly don't remember the reason.  My suggestion would be to change
the strdup to a memcpy, which should fix this particular problem.  If
you really want to remove the strdup, you would have to go through all
of the callers of do_get_post_url and make sure that none of them
require the duplicated data.

Anyway, thanks for looking into it!

Chris

Reply via email to