]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test_istream_jsonstr_partial() - Rearrange code to prevent unspecified order...
authorMarco Bettini <marco.bettini@open-xchange.com>
Tue, 18 Jul 2023 08:35:12 +0000 (08:35 +0000)
committerMarco Bettini <marco.bettini@open-xchange.com>
Tue, 18 Jul 2023 12:43:15 +0000 (12:43 +0000)
Found by Coverity

src/lib/test-istream-jsonstr.c

index 626994d6a71b94c7774c8835c282f8e529372bb8..7b432e893c315447cda34a76bdb5922c33082c85 100644 (file)
@@ -116,8 +116,9 @@ static void test_istream_jsonstr_partial(void)
        test_assert(i_stream_read(input) == 2);
        test_assert(i_stream_read(input) == -1);
 
-       test_assert(memcmp(i_stream_get_data(input, &len), output, I_MIN(len, strlen(output))) == 0 &&
-                   len == strlen(output));
+       const unsigned char *data = i_stream_get_data(input, &len);
+       test_assert_cmp(len, ==, strlen(output));
+       test_assert_strcmp((const char*) data, output);
 
        i_stream_unref(&input);
        i_stream_unref(&input_data);