From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 6/7] libxc: Fix misleading use of strncpy code in build_hvm_info() Date: Fri, 3 Jul 2015 17:01:59 +0100 Message-ID: <1435939319.9447.176.camel@citrix.com> References: <1435772232-39085-1-git-send-email-Jennifer.Herbert@citrix.com> <1435772232-39085-7-git-send-email-Jennifer.Herbert@citrix.com> <21910.43344.641819.58412@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.43344.641819.58412@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:25 +0100, Ian Jackson wrote: > Jennifer Herbert writes ("[Xen-devel] [PATCH 6/7] libxc: Fix misleading use of strncpy code in build_hvm_info()"): > > hvm_info->signature is not a string, but an 64 bit int, and is not > > NULL terminated. The use of strncpy to populate it is inappropriate and > > potentially misleading. A cursory glance might have you thinking someone > > had miscounted the length of the string literal - not realising it was > > intentionally cropping of the null termination. > > Also, since we wish to initialise all of hvm_info->signature, and > > certainly no more, the use of sizeof is safer. > > Acked-by: Ian Jackson Applied.