From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH] libxl: Don't derefence null new_name pointer in libxl_domain_rename() Date: Mon, 1 Dec 2014 14:50:56 +0000 Message-ID: <1417445456.29138.33.camel@citrix.com> References: <1417444026-31044-1-git-send-email-euan.harris@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1417444026-31044-1-git-send-email-euan.harris@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Euan Harris , Konrad Rzeszutek Wilk Cc: Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Mon, 2014-12-01 at 14:27 +0000, Euan Harris wrote: > libxl__domain_rename() unconditionally dereferences its new_name > parameter, to check whether it is an empty string. Add a check to > avoid a segfault if new_name is null. > > Signed-off-by: Euan Harris Acked-by: Ian Campbell I think this is a good fix to have for 4.5, Konrad CCd. > --- > tools/libxl/libxl.c | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index f84f7c2..6e84b5d 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -385,6 +385,13 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid, > } > } > > + if (!new_name) { > + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, > + "new domain name not specified"); > + rc = ERROR_INVAL; > + goto x_rc; > + } > + > if (new_name[0]) { > /* nonempty names must be unique */ > uint32_t domid_e;