qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 08/27] qom: fix off-by-one


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 08/27] qom: fix off-by-one
Date: Tue, 07 Feb 2012 10:13:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 02/06/2012 03:19 PM, Anthony Liguori wrote:

              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 :-)

Ok, I'll change to strrchr too since I have to respin.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]