From 1d7fb4e38fa41abb5e65c957845f3db74755f3b2 Mon Sep 17 00:00:00 2001 From: 251 <251io@users.noreply.github.com> Date: Mon, 21 Sep 2015 23:51:10 +0200 Subject: [PATCH] Fixes a bug in the test_pbkdf2_hmac_sha256 test. This bug fix sets the length of the derived key in the last test_pbkdf2_hmac_sha256 test to 40 bytes to fix a buffer overflow, which is caused by the call to the pbkdf2_hmac_sha256 function, on the memory reserved by the local variable k. --- tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.c b/tests.c index f7c5789150..47d5724eb0 100644 --- a/tests.c +++ b/tests.c @@ -761,7 +761,7 @@ START_TEST(test_pbkdf2_hmac_sha256) ck_assert_mem_eq(k, fromhex("c5e478d59288c841aa530db6845c4c8d962893a001ce4e11a4963873aa98134a"), 32); strcpy((char *)s, "saltSALTsaltSALTsaltSALTsaltSALTsalt"); - pbkdf2_hmac_sha256((uint8_t *)"passwordPASSWORDpassword", 3*8, s, 9*4, 4096, k, 64, 0); + pbkdf2_hmac_sha256((uint8_t *)"passwordPASSWORDpassword", 3*8, s, 9*4, 4096, k, 40, 0); ck_assert_mem_eq(k, fromhex("348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9"), 40); } END_TEST