[Patch] Encode invalid chars in /proc/registry entries
Christian Franke
Christian.Franke@t-online.de
Fri Nov 16 19:25:00 GMT 2007
Hi Corinna,
Corinna Vinschen wrote:
>> ...
>>
>> Patch is tested with 1.5.24-2. Merge with HEAD looks good, but was not
>> actually tested. Therefore, no changelog provided yet.
>>
>
> Thanks for this patch. Apart from the missing ChangeLog I'm inclined
> to apply it to the upcoming 1.5.25 release, but I don't like to have it
> in HEAD as is.
>
Thanks, I would appreciate to have this issue fixed in the bugfix release.
Here is a new version of the patch and a ChangeLog.
The names "." and ".." are now also encoded. Theses are also valid as
Key/Value Names and ".." may result in infinite recursion.
> The reason is that the patch introduces more usages of CYG_MAX_PATH plus
> static buffers of that size. That's ok for 1.5, but that's not ok
> anymore for 1.7. We're heading to support PATH_MAX = ~32K paths. The
> registry also supports long paths, unfortunately with undefined max
> length. The current definition in MSDN(*) is
>
> Max name length of keys: 255 chars
> Max name length of values: 16383 chars
> Max tree depth: 512 levels
>
> So, for HEAD I'd like to ask you to allow arbitrary path lengths in your
> code. Personally I could live with restricting registry paths to
> PATH_MAX as well.
>
>
Agree. Probably Cygwin should never descend paths that exceed PATH_MAX,
as an application using PATH_MAX may have no buffer overflow check.
> While you're digging in registry code anyway... would you be interested
> to convert the entire registry code to wide char and long path names?
> I'd be glad for any help.
>
>
I will have a look at it, but be patient. Is current HEAD a reasonable
starting point or is there a better (more stable) snapshot?
Christian
2007-11-16 Christian Franke <franke@computer.org>
* fhandler_registry.cc (must_encode): New function.
(encode_regname): Ditto.
(decode_regname): Ditto.
(fhandler_registry::exists): Encode name before path compare.
(fhandler_registry::fstat): Pass decoded name to win32 registry call.
(fhandler_registry::readdir): Return encoded name to user.
(fhandler_registry::open): Store decoded name into value_name.
(open_key): Pass decoded name to win32 registry call.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygwin-1.5.24-2-regnames-encode-2.patch
Type: text/x-patch
Size: 4168 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20071116/0a2438c3/attachment.bin>
More information about the Cygwin-patches
mailing list