ia64/xen-unstable

changeset 9293:250ff103c291

fix buffer overflow in print XS_DEBUG command

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Wed Mar 15 12:24:34 2006 +0000 (2006-03-15)
parents 51b0d4c2d4d9
children 9af36c14ae83
files tools/xenstore/xenstored_core.c
line diff
     1.1 --- a/tools/xenstore/xenstored_core.c	Wed Mar 15 12:08:10 2006 +0000
     1.2 +++ b/tools/xenstore/xenstored_core.c	Wed Mar 15 12:24:34 2006 +0000
     1.3 @@ -1115,8 +1115,17 @@ static void do_set_perms(struct connecti
     1.4  
     1.5  static void do_debug(struct connection *conn, struct buffered_data *in)
     1.6  {
     1.7 -	if (streq(in->buffer, "print"))
     1.8 +	int num;
     1.9 +
    1.10 +	num = xs_count_strings(in->buffer, in->used);
    1.11 +
    1.12 +	if (streq(in->buffer, "print")) {
    1.13 +		if (num < 2) {
    1.14 +			send_error(conn, EINVAL);
    1.15 +			return;
    1.16 +		}
    1.17  		xprintf("debug: %s", in->buffer + get_string(in, 0));
    1.18 +	}
    1.19  	if (streq(in->buffer, "check"))
    1.20  		check_store();
    1.21  #ifdef TESTING