diff options
author | Christopher Faylor <me@cgf.cx> | 2004-10-17 23:31:23 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-10-17 23:31:23 +0000 |
commit | 0597641a7470e54d8aed7c6baa1082d5f2c0d7d9 (patch) | |
tree | d8af970b3aa298845dba411338c0375a77f4d767 /winsup | |
parent | 167f0d851375bb0c21b39a315526866b7b7affd1 (diff) | |
download | newlib-0597641a7470e54d8aed7c6baa1082d5f2c0d7d9.zip newlib-0597641a7470e54d8aed7c6baa1082d5f2c0d7d9.tar.gz newlib-0597641a7470e54d8aed7c6baa1082d5f2c0d7d9.tar.bz2 |
* cygcheck.cc (pretty_id): Allocate space for trailing '\0' on uid and guid.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/utils/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/utils/cygcheck.cc | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 1462b31..5e2e460 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,6 +1,12 @@ 2004-10-15 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl> Christopher Faylor <cgf@timesys.com> + * cygcheck.cc (pretty_id): Allocate space for trailing '\0' on uid and + guid. + +2004-10-15 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl> + Christopher Faylor <cgf@timesys.com> + * cygcheck.cc (pretty_id): Don't exit on id error. Fix size calculations. diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index 64130ee..c5df4c3 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -814,10 +814,10 @@ pretty_id (const char *s, char *cygwin, size_t cyglen) } char **ng = groups - 1; - size_t len_uid = strlen (uid); - size_t len_gid = strlen (gid); - *++ng = groups[0] = (char *) alloca (len_uid += sizeof ("UID: )") - 1); - *++ng = groups[1] = (char *) alloca (len_gid += sizeof ("GID: )") - 1); + size_t len_uid = strlen ("UID: ") + strlen (uid); + size_t len_gid = strlen ("GID: ") + strlen (gid); + *++ng = groups[0] = (char *) alloca (len_uid + 1); + *++ng = groups[1] = (char *) alloca (len_gid + 1); sprintf (groups[0], "UID: %s)", uid); sprintf (groups[1], "GID: %s)", gid); size_t sz = max (len_uid, len_gid); |