Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2005-09-08 13:24:41 +0400
committerCorinna Vinschen <corinna@vinschen.de>2005-09-08 13:24:41 +0400
commitb17b7644d583b8ffab14bf4ced9fee199a6d9a4c (patch)
treedc072556a5ddec841897fb6a072c089d99742c11 /winsup/utils
parent70d0243ce9d627f9aa79b3eccbf0747347ba7b1a (diff)
* regtool.cc: Extend copyright-years.
(print_version): Ditto. (cmd_list): Don't depend on terminating '\0' being present on string-values. (cmd_get): Don't attempt to read more than present, but keep extra space for terminating '\0'. Really output REG_BINARY. Don't leak memory. (cmd_set): Include trailing '\0' in string's length.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/ChangeLog11
-rw-r--r--winsup/utils/regtool.cc15
2 files changed, 19 insertions, 7 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 71ad18006..da4cc028d 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,14 @@
+2005-09-08 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
+
+ * regtool.cc: Extend copyright-years.
+ (print_version): Ditto.
+ (cmd_list): Don't depend on terminating '\0' being present on
+ string-values.
+ (cmd_get): Don't attempt to read more than present, but keep
+ extra space for terminating '\0'. Really output REG_BINARY.
+ Don't leak memory.
+ (cmd_set): Include trailing '\0' in string's length.
+
2005-08-18 Corinna Vinschen <corinna@vinschen.de>
* passwd.c (longopts): Add --logonserver option.
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc
index 45263e369..daea35a22 100644
--- a/winsup/utils/regtool.cc
+++ b/winsup/utils/regtool.cc
@@ -1,6 +1,6 @@
/* regtool.cc
- Copyright 2000, 2001, 2002, 2003, 2004 Red Hat Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat Inc.
This file is part of Cygwin.
@@ -138,7 +138,7 @@ print_version ()
printf ("\
%s (cygwin) %.*s\n\
Registry Tool\n\
-Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
+Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.\n\
Compiled on %s\n\
", prog_name, len, v, __DATE__);
}
@@ -398,6 +398,7 @@ cmd_list ()
m = maxvalnamelen + 1;
n = maxvaluelen + 1;
RegEnumValue (key, i, value_name, &m, 0, &t, (BYTE *) value_data, &n);
+ value_data[n] = 0;
if (!verbose)
printf ("%s\n", value_name);
else
@@ -515,11 +516,11 @@ cmd_set ()
sizeof (v));
break;
case KT_STRING:
- rv = RegSetValueEx (key, value, 0, REG_SZ, (const BYTE *) a, strlen (a));
+ rv = RegSetValueEx (key, value, 0, REG_SZ, (const BYTE *) a, strlen (a) + 1);
break;
case KT_EXPAND:
rv = RegSetValueEx (key, value, 0, REG_EXPAND_SZ, (const BYTE *) a,
- strlen (a));
+ strlen (a) + 1);
break;
case KT_MULTI:
for (i = 1, n = 1; argv[i]; i++)
@@ -569,15 +570,14 @@ cmd_get ()
rv = RegQueryValueEx (key, value, 0, &vtype, 0, &dsize);
if (rv != ERROR_SUCCESS)
Fail (rv);
- dsize++;
- data = (char *) malloc (dsize);
+ data = (char *) malloc (dsize + 1);
rv = RegQueryValueEx (key, value, 0, &vtype, (BYTE *) data, &dsize);
if (rv != ERROR_SUCCESS)
Fail (rv);
switch (vtype)
{
case REG_BINARY:
- fwrite (data, dsize, 0, stdout);
+ fwrite (data, dsize, 1, stdout);
break;
case REG_DWORD:
printf ("%lu\n", *(DWORD *) data);
@@ -593,6 +593,7 @@ cmd_get ()
bufsize = ExpandEnvironmentStrings (data, 0, 0);
buf = (char *) malloc (bufsize + 1);
ExpandEnvironmentStrings (data, buf, bufsize + 1);
+ free (data);
data = buf;
}
printf ("%s\n", data);