cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Working with curl connections as with sockets.

From: Michal Marek <mmarek_at_suse.cz>
Date: Fri, 09 May 2008 13:19:07 +0200

Daniel Stenberg napsal(a):
> On Tue, 6 May 2008, tetetest tetetest wrote:
>
>>> Hypothetically, what is the worst that could happen if we just do the
>>> cast and one of the krb libs *does* touch the buffer?
>>
>> A SIGSEGV. :) Compiler can place const data into read-only memory
>> page, so any attempt to modify it will result in access violation.
>
> Right, but that would require us to use constant data in the first place
> and I don't see this happening. We pass in a buffer in memory that we
> fill with data in an earlier function.

Inside libcurl, yes. But if we are going to provide a curl_easy_send()
with a const pointer argument, then we have to make sure that the buffer
(which can be a string literal for instance) really isn't written to.

But the good news is that krb4, krb5 heimdal and gnu gss all seem to
behave well, so the const cast should be safe. I'll commit the patch in
a minute.

Michal
Received on 2008-05-09