From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4yfP-0003ke-QJ for qemu-devel@nongnu.org; Wed, 09 Jul 2014 16:40:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4yfK-0002LL-UB for qemu-devel@nongnu.org; Wed, 09 Jul 2014 16:40:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4yfK-0002L9-KX for qemu-devel@nongnu.org; Wed, 09 Jul 2014 16:40:34 -0400 Message-ID: <53BDA8BA.4090504@redhat.com> Date: Wed, 09 Jul 2014 14:40:26 -0600 From: Eric Blake MIME-Version: 1.0 References: <1404937729-19780-1-git-send-email-afaerber@suse.de> In-Reply-To: <1404937729-19780-1-git-send-email-afaerber@suse.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dxAbPXnA2G5Pqe2AhAc1xi4gR9tVn6O4d" 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?B?QW5kcmVhcyBGw6RyYmVy?= , qemu-devel@nongnu.org Cc: Peter Maydell , Hu Tao , "Michael S. Tsirkin" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --dxAbPXnA2G5Pqe2AhAc1xi4gR9tVn6O4d Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/09/2014 02:28 PM, 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 rando= m > assertion failures: >=20 > ERROR:tests/test-string-output-visitor.c:213:test_visitor_out_enum: as= sertion failed (str =3D=3D str_human): ("\"value1\"" =3D=3D "\"value1\"\0= 01EEEEEEEEEEEEEE\0171") >=20 > There is no g_assert_cmpnstr() counterpart, so use g_strdup_printf() > for safely assembling the string in the first place. >=20 > Cc: Hu Tao > Cc: Michael S. Tsirkin > Suggested-by: Eric Blake > Fixes: b4900c0 tests: add human format test for string output visitor > Signed-off-by: Andreas F=C3=A4rber > --- > tests/test-string-output-visitor.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --dxAbPXnA2G5Pqe2AhAc1xi4gR9tVn6O4d Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTvai6AAoJEKeha0olJ0NqnfIH/24vGXZCYrpGixVz+e/NuhoM Jc0LFhDPT88y0rloKDD4a6So2wEegjpezd2GCDp50YEGYBeq1CuSrlbxMiYwaul4 h1zi5s4IJ/PmNDiWakmpljZTyBVg/JMLPbOyUtHh8GulmTIS0pYIA5tvU/HUK6GQ H0JJ/lG1fSVXQyZ0ZLKE9wx3KzNbl5/8HhDvb8Ryux5q6+YxS4sC5cbzzekWBD4e XkM9qi+lJVuFROVlwWc532DqUBKx9PdcXNUu8Wtpkp8vWjW6YoDHAQ/W7JD1FnXf DYyzZaOVNBfylWTHmnEQpsgxOsu4WgACajI2WZo0kemWRk0YT96H/f5kU5a4vqk= =lLt/ -----END PGP SIGNATURE----- --dxAbPXnA2G5Pqe2AhAc1xi4gR9tVn6O4d--