From: Ian Jackson Subject: Re: [PATCH] tools: misc: xen-tmem-list-parse: fix output ugliness Date: Tue, 29 Nov 2011 16:34:12 +0000 Message-ID: <20181.2436.299217.351814@mariner.uk.xensource.com> References: <20171.55835.240381.351382@mariner.uk.xensource.com> <20174.36841.738985.984736@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Dan Magenheimer Cc: xen-devel@lists.xensource.com, stefano.stabellini@eu.citrix.com, Konrad Wilk List-Id: xen-devel@lists.xenproject.org Dan Magenheimer writes ("Re: [Xen-devel] [PATCH] tools: misc: xen-tmem-list-parse: fix output ugliness"): > Ian Jackson [mailto:Ian.Jackson@eu.citrix.com] > > I think functions with prototypes like > > f(int len, char *buf) > > should take buf[len], not buf[len+1]. > > FWIW, I agree completely. I didn't write this code from > scratch, I heavily leveraged it from elsewhere (don't > recall exactly where, maybe xentop?). > > If necessary, I will rewrite the callers and API but > I was just trying to fix an annoying bug expeditiously. > Let me know if you won't accept it as the one-line > ugly fix. I really don't want to make this worse. Previously the function would not write past len. So sorry, would you mind fixing the callers ? Also if you "leveraged" this code perhaps it should be combined or the original one fixed or something ? Thanks, Ian.