diff options
author | Andreas Färber <afaerber@suse.de> | 2014-07-09 22:28:49 +0200 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-07-10 11:53:14 +0100 |
commit | 9e99c5fd7060267a0331d900e73fdb36047bfe0c (patch) | |
tree | 6d4a4dcf1bda9ee1c92f7ee6f2c96d84b2bed0f7 /target-lm32 | |
parent | 675879f6f3c9463e103735a4e41e9deb0bee9b39 (diff) |
tests: Fix unterminated string output visitor enum human string
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.
Cc: Hu Tao <hutao@cn.fujitsu.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Suggested-by: Eric Blake <eblake@redhat.com>
Fixes: b4900c0 tests: add human format test for string output visitor
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-lm32')
0 files changed, 0 insertions, 0 deletions