From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:58682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuPQG-0007Td-A3 for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:20:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RuPQA-0000ZU-Og for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:20:00 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:51350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuPQA-0000ZQ-Hn for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:19:54 -0500 Received: by dadp14 with SMTP id p14so6477686dad.4 for ; Mon, 06 Feb 2012 06:19:53 -0800 (PST) Message-ID: <4F2FE185.1060301@codemonkey.ws> Date: Mon, 06 Feb 2012 08:19:49 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1328342577-25732-1-git-send-email-pbonzini@redhat.com> <1328342577-25732-9-git-send-email-pbonzini@redhat.com> In-Reply-To: <1328342577-25732-9-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 08/27] qom: fix off-by-one List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 02/04/2012 02:02 AM, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini > --- > qom/object.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/qom/object.c b/qom/object.c > index b26272f..314fc7a 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -871,7 +871,7 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque, > gchar *target_type; > > target_type = g_strdup(&type[5]); > - target_type[strlen(target_type) - 2] = 0; > + *strchr(target_type, '>') = 0; Should use an intermediate variable here and do a NULL check. My eyes can't handle dereferencing strchr() directly even if I understand why it's safe to do :-) Regards, Anthony Liguori > > if (object_dynamic_cast(target, target_type)) { > object_ref(target);