summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2001-05-12 00:20:32 +0000
committerMarcus Brinkmann <marcus@gnu.org>2001-05-12 00:20:32 +0000
commit6c9fdb369129b22b9212e4d82f3fadb15df45eca (patch)
tree8ba3580038f39ef690d5adf5a3a377753f9c169f
parent4b4f61e2b0cf3a2db99d67456e8fe34ebabbb282 (diff)
2001-05-12 Marcus Brinkmann <marcus@gnu.org>
* host.c (initialize_version_info): Clear last byte of KV to make sure that the string is null-terminated.
-rw-r--r--proc/ChangeLog5
-rw-r--r--proc/host.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/proc/ChangeLog b/proc/ChangeLog
index e97f6c57..b41a25e9 100644
--- a/proc/ChangeLog
+++ b/proc/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-12 Marcus Brinkmann <marcus@gnu.org>
+
+ * host.c (initialize_version_info): Clear last byte of KV to make
+ sure that the string is null-terminated.
+
2000-04-03 Neal H Walfield <neal@cs.uml.edu>
* proc.h (struct ids): Drop gids and ngids, we never use
diff --git a/proc/host.c b/proc/host.c
index e34b33af..30353a05 100644
--- a/proc/host.c
+++ b/proc/host.c
@@ -352,13 +352,16 @@ initialize_version_info (void)
mach_cpu_subtypes[info.cpu_type][info.cpu_subtype]);
/* Notice Mach's and our own version and initialize server version
- varables. */
+ variables. */
server_versions = malloc (sizeof (struct server_version) * 10);
assert (server_versions);
server_versions_nalloc = 10;
err = host_kernel_version (mach_host_self (), kv);
assert (! err);
+ /* Make sure the result is null-terminated, as the kernel doesn't
+ guarantee it. */
+ kv[sizeof (kv) - 1] = '\0';
p = index (kv, ':');
if (p)
*p = '\0';