curl-library
RE: patch to make drive letters work in file:// urls under Window s
Date: Fri, 8 Aug 2003 10:50:40 -0700
On Fri, 8 Aug 2003, Daniel Stenberg wrote:
> Thanks. I've applied and committed with a minor fix: since
> you increase the path pointer, we need to be careful to
> always free() to original pointer before the increment.
Thanks for catching that. Something else that Dan Fandrich mentioned that I
didn't implement was length checking. This may open a bigger can of worms,
but Curl_file_connect dereferences conn and conn->path without checking for
NULL. The patch also dereferences path[2] without checking first that the
string is that long.
Do you have some global policy for checking for NULL? Something that uses
assert or some custom defined ASSERT()?
In any case, here's a patch to add a strlen() check before dereferencing
actual_path[2] (diff against file.c.1.32). Had the urge to add some
parentheses which I should have added before. Hope that's OK.
A few ways to test this come to mind. All of them require a bit more code
-- either more messages, and teaching the test harness to look at them, or
some external memory test tool.
-DB
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
- application/octet-stream attachment: file.c.1.32.patch