This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[patch] Don't append extra NUL to registry-strings.
- From: Bas van Gompel <cygwin-patches dot buzz at bavag dot tmfweb dot nl>
- To: cygwin-patches at cygwin dot com
- Date: Sun, 28 Aug 2005 22:49:39 +0200 (MET DST)
- Subject: [patch] Don't append extra NUL to registry-strings.
- Organisation: Ehm...
- Reply-to: cygwin-patches mailing-list <cygwin-patches at cygwin dot com>
Hi,
When RegQueryValueEx returns a string-type, the final NUL is included
in the returned size. I suggest dropping it.
A ChangeLog-entry?
2005-08-28 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
*fhandler_registry.cc (fhandler_registry::fill_filebuf): Don't
keep terminating null-character on string-types.
diff -u -p -r1.33 fhandler_registry.cc
--- src/winsup/cygwin/fhandler_registry.cc 24 Aug 2005 04:38:39 -0000 1.33
+++ src/winsup/cygwin/fhandler_registry.cc 28 Aug 2005 17:38:18 -0000
@@ -599,6 +599,8 @@ fhandler_registry::fill_filebuf ()
while (error == ERROR_MORE_DATA);
filesize = size;
}
+ if (type == REG_SZ || type == REG_MULTI_SZ || type == REG_EXPAND_SZ)
+ filesize--;
return true;
value_not_found:
DWORD buf_size = CYG_MAX_PATH;
L8r,
Buzz.
--
) | | ---/ ---/ Yes, this | This message consists of true | I do not
-- | | / / really is | and false bits entirely. | mail for
) | | / / a 72 by 4 +-------------------------------+ any1 but
-- \--| /--- /--- .sigfile. | |perl -pe "s.u(z)\1.as." | me. 4^re