ia64/xen-unstable

changeset 7882:418954da5c0f

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>
author emellor@leeni.uk.xensource.com
date Thu Nov 17 12:59:12 2005 +0100 (2005-11-17)
parents 3f39f030fa89
children 80e393599413
files tools/console/daemon/io.c
line diff
     1.1 --- a/tools/console/daemon/io.c	Wed Nov 16 20:33:23 2005 +0100
     1.2 +++ b/tools/console/daemon/io.c	Thu Nov 17 12:59:12 2005 +0100
     1.3 @@ -114,7 +114,7 @@ static void buffer_append(struct domain 
     1.4  			buffer->data, buffer->max_capacity);
     1.5  		buffer->data = realloc(buffer->data,
     1.6  				       buffer->max_capacity);
     1.7 -		buffer->capacity = buffer->max_capacity;
     1.8 +		buffer->size = buffer->capacity = buffer->max_capacity;
     1.9  	}
    1.10  }
    1.11