From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5EPv-0003kR-VY for qemu-devel@nongnu.org; Thu, 10 Jul 2014 09:29:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X5EPq-00076L-2x for qemu-devel@nongnu.org; Thu, 10 Jul 2014 09:29:43 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:43800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X5EPp-000769-SN for qemu-devel@nongnu.org; Thu, 10 Jul 2014 09:29:38 -0400 Received: by mail-la0-f47.google.com with SMTP id s18so6206915lam.34 for ; Thu, 10 Jul 2014 06:29:36 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1404937729-19780-1-git-send-email-afaerber@suse.de> References: <1404937729-19780-1-git-send-email-afaerber@suse.de> From: Peter Maydell Date: Thu, 10 Jul 2014 14:29:16 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH buildfix for-2.1] tests: Fix unterminated string output visitor enum human string List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=C3=A4rber?= Cc: Hu Tao , QEMU Developers , "Michael S. Tsirkin" On 9 July 2014 21:28, Andreas F=C3=A4rber wrote: > The buffer was being allocated of size string length plus two. > Around the string two quotes were being added, but no terminating NUL. > It was then compared using g_assert_cmpstr(), resulting in fairly random > assertion failures: > > ERROR:tests/test-string-output-visitor.c:213:test_visitor_out_enum: asse= rtion failed (str =3D=3D str_human): ("\"value1\"" =3D=3D "\"value1\"\001EE= EEEEEEEEEEEE\0171") > > There is no g_assert_cmpnstr() counterpart, so use g_strdup_printf() > for safely assembling the string in the first place. Applied to master as a buildfix, thanks. -- PMM