Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rizlik
Copy link
Contributor

@rizlik rizlik commented Sep 24, 2025

I'm puzzled how static analysis or ASAN can miss this.
At least for ASAN, I think the reason is that the Aes struct is big enough to don't overflow the struct.
making the struct smaller by removing HAVE_AES_GCM triggers an error immediately at compile time with clang

clang  -std=c90 -Werror -Wall -Wextra -ffunction-sections -fdata-sections -ggdb -g3 -fsanitize=address -D_POSIX_C_SOURCE=200809L -DWOLFSSL_USER_SETTINGS -DWOLFHSM_CFG -DWOLFHSM_CFG_TEST_POSIX -DWOLFHSM_CFG_DMA -DWOLFHSM_CFG_ENABLE_CLIENT -DWOLFHSM_CFG_ENABLE_SERVER -DWOLFHSM_CFG_IS_TEST_SERVER -I. -I./config -I../../wolfssl -I../ -I..//port/posix -c -o Build/wh_server_crypto.o ..//src/wh_server_crypto.c
..//src/wh_server_crypto.c:1374:13: error: 'memcpy' will always overflow; destination buffer has size 160, but size argument is 256 [-Werror,-Wfortify-source]
 1374 |             memcpy(aes->tmp, tmp, AES_MAX_KEY_SIZE);
      |             ^
1 error generated.

@miyazakh
Copy link
Contributor

Thanks for the fix.

@bigbrett bigbrett merged commit c81701c into wolfSSL:main Sep 24, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants