[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH buildfix for-2.1] tests: Fix unterminated string
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH buildfix for-2.1] tests: Fix unterminated string output visitor enum human string |
Date: |
Thu, 10 Jul 2014 14:29:16 +0100 |
On 9 July 2014 21:28, Andreas Färber <address@hidden> 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:
> assertion failed (str == str_human): ("\"value1\"" ==
> "\"value1\"\001EEEEEEEEEEEEEE\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