unit-tests: Fix test_chunk_eq() if arguments have side-effects
authorTobias Brunner <tobias@strongswan.org>
Wed, 24 May 2017 07:34:17 +0000 (09:34 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 24 May 2017 07:34:17 +0000 (09:34 +0200)
src/libstrongswan/tests/test_suite.h

index 66c6846..97c1b42 100644 (file)
@@ -298,7 +298,7 @@ void test_fail_if_worker_failed();
        chunk_t _a = (chunk_t)a; \
        chunk_t _b = (chunk_t)b; \
        test_fail_if_worker_failed(); \
-       if (_a.len != _b.len || !memeq(a.ptr, b.ptr, a.len)) \
+       if (_a.len != _b.len || !memeq(_a.ptr, _b.ptr, _a.len)) \
        { \
                test_fail_msg(__FILE__, __LINE__, \
                                          #a " != " #b " (\"%#B\" != \"%#B\")", &_a, &_b); \