From b46c24edb7b8acba387b8621f867b7d4c5fce1b3 Mon Sep 17 00:00:00 2001 From: Dan Magenheimer Date: Wed, 14 Nov 2012 10:24:28 +0000 Subject: xen-tmem-list-parse: fix ugly parse output The program xen-tmem-list-parse parses the output of xm/xl tmem-list into human-readable format. A missing NULL terminator sometimes causes garbage to be spewed where the two-letter pool type should be output. Signed-off-by: Dan Magenheimer Acked-by: Ian Campbell Committed-by: Ian Campbell --- tools/misc/xen-tmem-list-parse.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/misc') diff --git a/tools/misc/xen-tmem-list-parse.c b/tools/misc/xen-tmem-list-parse.c index 977e4d3cc2..f32b107dce 100644 --- a/tools/misc/xen-tmem-list-parse.c +++ b/tools/misc/xen-tmem-list-parse.c @@ -243,6 +243,7 @@ void parse_pool(char *s) unsigned long long flush_objs = parse(s,"ot"); parse_string(s,"PT",pool_type,2); + pool_type[2] = '\0'; if (pool_type[1] == 'S') return; /* no need to repeat print data for shared pools */ printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) " @@ -286,6 +287,7 @@ void parse_shared_pool(char *s) unsigned long long flush_objs = parse(s,"ot"); parse_string(s,"PT",pool_type,2); + pool_type[2] = '\0'; parse_sharers(s,"SC",buf,BUFSIZE); printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: " "pgp=%llu(max=%llu) obj=%llu(%llu) " -- cgit v1.2.3