From: Keir Fraser Date: Fri, 14 May 2010 06:56:43 +0000 (+0100) Subject: xl: Check invalid domid in find_domain() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12164 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=102f8460cabeff2c39c677664e9669ae550a2f64;p=xen.git xl: Check invalid domid in find_domain() If domain id is invalid, find_domain should return error because the specified domain does not exist. Signed-off-by: Yang Hongyang --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 2101ee58d0..4faf61971e 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -137,7 +137,11 @@ static void find_domain(const char *p) fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc); exit(2); } - common_domname = was_name ? p : 0; + common_domname = was_name ? p : libxl_domid_to_name(&ctx, domid); + if (!common_domname) { + fprintf(stderr, "%s is an invalid domain identifier.\n", p); + exit(2); + } } #define LOG(_f, _a...) dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)