aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>2005-11-17 12:59:12 +0100
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>2005-11-17 12:59:12 +0100
commit3805ba3b8ac61cf007fd92226b1ebed0a5828aa2 (patch)
tree38d251a31eb35d37fe1556de78f8ab8403e07eaa /tools/console
parentb3670cac54c24e587eeefdc38fd1f70ce81c37ee (diff)
downloadxen-3805ba3b8ac61cf007fd92226b1ebed0a5828aa2.tar.gz
xen-3805ba3b8ac61cf007fd92226b1ebed0a5828aa2.tar.bz2
xen-3805ba3b8ac61cf007fd92226b1ebed0a5828aa2.zip
Correct buffer->size at the same time as buffer->capacity when shrinking down a
buffer that has grown beyond max_capacity. This fixes a Xenconsoled segfault that was caused by stomping around above the buffer's allocated region. It became possible to set the max_capacity with changeset 7431, and ever since then we have been exposed to this bug. It would most easily be triggered by running a domain without a client attached to the console, so that the max_capacity was reached more easily. Closes bug #380. Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/daemon/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index 6a9de1b48f..80e76c416e 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -114,7 +114,7 @@ static void buffer_append(struct domain *dom)
buffer->data, buffer->max_capacity);
buffer->data = realloc(buffer->data,
buffer->max_capacity);
- buffer->capacity = buffer->max_capacity;
+ buffer->size = buffer->capacity = buffer->max_capacity;
}
}