xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Eamon Walsh <ewalsh@tycho.nsa.gov>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Xen-devel <xen-devel@lists.xensource.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [PATCH] libxenlight: fix heap overflow when	domid_to_name returns NULL
Date: Mon, 07 Mar 2011 10:33:03 -0500	[thread overview]
Message-ID: <4D74FAAF.7040105@tycho.nsa.gov> (raw)
In-Reply-To: <1299232954.6552.242.camel@zakaz.uk.xensource.com>

On 03/04/2011 05:02 AM, Ian Campbell wrote:
> On Thu, 2011-03-03 at 23:29 +0000, Eamon Walsh wrote:
>> The function flexarray_vappend() will stop at the first NULL
>> argument.  In libxl_device_vfb_add(), this has been observed
>> to result in keys being added to the backend array without
>> associated values in cases where the value can be NULL.
> If these values are NULL should we be writing them at all? e.g. for:
> 	flexarray_vappend(back, foo, bar);
> where bar may be NULL shouldn't it become:
> 	if (bar) 
> 		flexarray_vappend(back, foo, bar);
> or perhaps:
> 	flexarray_vappend(back, foo, bar ? bar : "");
> ?
>

If the value is NULL, the key is skipped and not written.  This is because of a patch I submitted to change the xs_writev() function, which was calling strlen(NULL) previously.  See:
http://lists.xensource.com/archives/html/xen-devel/2010-03/msg00703.html

However this behavior is not obvious.  Checking the value earlier and leaving it off the list makes sense.



-- 

Eamon Walsh 
National Security Agency

  parent reply	other threads:[~2011-03-07 15:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03 23:29 [PATCH] libxenlight: fix heap overflow when domid_to_name returns NULL Eamon Walsh
2011-03-04 10:02 ` Ian Campbell
2011-03-07 13:12   ` Stefano Stabellini
2011-03-07 14:13     ` Ian Campbell
2011-03-07 15:04       ` Stefano Stabellini
2011-03-07 15:07         ` Ian Campbell
2011-03-07 15:08           ` Stefano Stabellini
2011-03-07 15:33   ` Eamon Walsh [this message]
2011-03-07 16:44     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D74FAAF.7040105@tycho.nsa.gov \
    --to=ewalsh@tycho.nsa.gov \
    --cc=Ian.Campbell@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).