From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 7/7] libxc: Prevent NULL pointer dereference in stdiostream_vmessage() Date: Fri, 3 Jul 2015 16:37:13 +0100 Message-ID: <1435937833.9447.163.camel@citrix.com> References: <1435772232-39085-1-git-send-email-Jennifer.Herbert@citrix.com> <1435772232-39085-8-git-send-email-Jennifer.Herbert@citrix.com> <21910.43622.881262.599608@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21910.43622.881262.599608@mariner.uk.xensource.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: Ian Jackson Cc: wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com, Jennifer Herbert , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, 2015-07-03 at 16:29 +0100, Ian Jackson wrote: > Jennifer Herbert writes ("[Xen-devel] [PATCH 7/7] libxc: Prevent NULL pointer dereference in stdiostream_vmessage()"): > > Unlikely that it may seem localtime_r could fail, which would result in a > > null pointer dereference. In this case, one can simply just skip logging the > > date/time, and logging anything is more useful then nothing. > > I think it would be best, in this error case, to explicitly note that > date/time conversion failed, by printing (say) "[localtime_r failed: > ]". Sadly that will involve calling strerror and doing > something sensible if strerror fails, too. Perhaps a smaller yakk would be to just include the numeric errno? For such a rare error case having to worry about two layers of nested error handling seems annoying... Ian