From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KXiJa-0006tx-Nb for qemu-devel@nongnu.org; Mon, 25 Aug 2008 16:05:26 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KXiJW-0006s1-Vz for qemu-devel@nongnu.org; Mon, 25 Aug 2008 16:05:26 -0400 Received: from [199.232.76.173] (port=39661 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KXiJW-0006rv-S2 for qemu-devel@nongnu.org; Mon, 25 Aug 2008 16:05:22 -0400 Received: from el-out-1112.google.com ([209.85.162.179]:5556) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KXiJW-0001UL-9S for qemu-devel@nongnu.org; Mon, 25 Aug 2008 16:05:22 -0400 Received: by el-out-1112.google.com with SMTP id y26so163513ele.19 for ; Mon, 25 Aug 2008 13:05:20 -0700 (PDT) Message-ID: Date: Mon, 25 Aug 2008 23:05:19 +0300 From: "Blue Swirl" Subject: Re: [Qemu-devel] [PATCH] qemu_strdup() doesn't copy alast character In-Reply-To: <20080825092211.GG6192@minantech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080825092211.GG6192@minantech.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On 8/25/08, Gleb Natapov wrote: > > Because of off by one error. > > > Signed-off-by: Gleb Natapov > > diff --git a/qemu-malloc.c b/qemu-malloc.c > index 8ad6168..3bffae1 100644 > --- a/qemu-malloc.c > +++ b/qemu-malloc.c > @@ -60,6 +60,6 @@ char *qemu_strdup(const char *str) > ptr = qemu_malloc(len + 1); > if (!ptr) > return NULL; > - pstrcpy(ptr, len, str); > + pstrcpy(ptr, len + 1, str); > return ptr; > } Thanks, applied. I had introduced this in the patch (r5044) where I changed some strcpys to pstrcpys. Maybe the same bug got in somewhere else too.