From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcAVB-0007bs-0F for qemu-devel@nongnu.org; Thu, 30 Jun 2011 02:13:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcAVA-0000nz-1C for qemu-devel@nongnu.org; Thu, 30 Jun 2011 02:13:24 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:42367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcAV9-0000nt-TN for qemu-devel@nongnu.org; Thu, 30 Jun 2011 02:13:23 -0400 Received: by ywb3 with SMTP id 3so894640ywb.4 for ; Wed, 29 Jun 2011 23:13:22 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1309224777-31024-1-git-send-email-famcool@gmail.com> <1309224777-31024-10-git-send-email-famcool@gmail.com> Date: Thu, 30 Jun 2011 07:13:22 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 09/12] VMDK: open/read/write for monolithicFlat image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, qemu-devel@nongnu.org, hch@lst.de On Thu, Jun 30, 2011 at 2:57 AM, Fam Zheng wrote: > On Wed, Jun 29, 2011 at 11:57 PM, Stefan Hajnoczi wr= ote: >> On Tue, Jun 28, 2011 at 2:32 AM, Fam Zheng wrote: >>> + =A0 =A0 =A0 =A0/* trim the quotation marks around */ >>> + =A0 =A0 =A0 =A0if (fname[0] =3D=3D '"') { >>> + =A0 =A0 =A0 =A0 =A0 =A0memmove(fname, fname + 1, strlen(fname) + 1); >> >> This copies 1 byte too many, just strlen(fname) will do. > I meant to copy the NULL terminator too. Yes. The problem is the copying starts at fname + 1 but strlen(3) starts at fname. So there is already an extra byte. The + 1 adds an additional byte after the NUL. Stefan