[patch] Don't append extra NUL to registry-strings.

Dave Korn dave.korn@artimi.com
Tue Aug 30 10:33:00 GMT 2005

----Original Message----
>From: Corinna Vinschen
>Sent: 29 August 2005 09:21

> On Aug 28 22:49, Bas van Gompel wrote:
>> Hi,
>> When RegQueryValueEx returns a string-type, the final NUL is included
>> in the returned size. I suggest dropping it.
> I see what you're up to, but there would be two reasons not to drop the
> trailing \0.  First, the \0 is part of the "file content" in a way.

  To me this is the even more important reason.  Some registry strings do
include the trailing zero, some don't; cygwin shouldn't tamper with it.  And
it would seem _very_ wrong to me if by querying a value, and then using the
result returned to re-set the value, the value should change in length.

  And since the patch unconditionally chops one off the size without
verifying whether or not the nul terminator is actually present, it would do
the wrong thing for some strings.

Can't think of a witty .sigline today....

More information about the Cygwin-patches mailing list