wintrust/test: Verify array length before calling memcmp in test (RESEND)

James Hawkins truiken at
Mon Jul 7 17:12:39 CDT 2008

On Mon, Jul 7, 2008 at 5:05 PM, Roy Shea <royshea at> wrote:
> This revision uses a more concise check of hash equality than prior
> patch archived at:
> Call to memcmp in test_calchash assumes length of hash and expectedhash
> are the same.  This need not be true in general, and is not true for the
> current stub implementation of CryptCATAdminCalcHashFromFileHandle.
> This patch adds an explicit test of array length.  In doing so it
> prevents the following Valgrind warning:

@@ -335,7 +335,9 @@ static void test_calchash(void)
     ok(GetLastError() == ERROR_SUCCESS,
        "Expected ERROR_SUCCESS, got %d\n", GetLastError());
-    ok(!memcmp(hash, expectedhash, sizeof(expectedhash)), "Hashes
didn't match\n");
+    ok(hashsize == sizeof(expectedhash) &&
+            !memcmp(hash, expectedhash, sizeof(expectedhash)),
+            "Hashes didn't match\n");

What's with the weird spacing?  It doesn't match the spacing of the ok
call right above it.

James Hawkins

More information about the wine-devel mailing list