Skip to content

Commit

Permalink
Fix buffer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
manastasova committed Feb 3, 2025
1 parent dc83a25 commit 95d3add
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/fipsmodule/sha/sha3_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class SHA3TestVector {

// Test Squeeze
// Assert success when |EVP_DigestSqueeze| is called in set byte increments
for (num_tests = 0, i = 0; num_tests < sizeof(stride_tests); num_tests++, i = 0) {
for (num_tests = 0, i = 0; num_tests < (sizeof(stride_tests)/sizeof(stride_tests[0])); num_tests++, i = 0) {
OPENSSL_memset(digest.get(), 0, digest_length);
ASSERT_TRUE(EVP_DigestInit(ctx.get(), algorithm));
ASSERT_TRUE(EVP_DigestUpdate(ctx.get(), msg_.data(), msg_.size()));
Expand Down Expand Up @@ -235,7 +235,7 @@ class SHA3TestVector {
// Test Squeeze with random Input
// Assert success when |EVP_DigestSqueeze| is called on a random message
// in set byte increments
for (num_tests = 0, i = 0; num_tests < sizeof(stride_tests); num_tests++, i = 0) {
for (num_tests = 0, i = 0; num_tests < (sizeof(stride_tests)/sizeof(stride_tests[0])); num_tests++, i = 0) {
OPENSSL_memset(digest_stream.get(), 0, expected_output_size);
ASSERT_TRUE(EVP_DigestInit(ctx.get(), algorithm));
ASSERT_TRUE(EVP_DigestUpdate(ctx.get(), random_bytes.data(), num_bytes));
Expand Down

0 comments on commit 95d3add

Please sign in to comment.