Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix a stack overflow triggered by small DHT packets. #2255

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion other/bootstrap_daemon/docker/tox-bootstrapd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
139fe825b90c022bbefd3837c2a427ab9215be3ca62144ea7ff12ae7389c78ba /usr/local/bin/tox-bootstrapd
37e68ca853cd8b01b26c8d8c61d1db6546c08ed294f5650b691b7aadaf47ee18 /usr/local/bin/tox-bootstrapd
2 changes: 1 addition & 1 deletion toxcore/DHT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ static int handle_data_search_response(void *object, const IP_Port *source,

const int32_t plain_len = (int32_t)length - (1 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE + CRYPTO_MAC_SIZE);

if (plain_len < CRYPTO_PUBLIC_KEY_SIZE + sizeof(uint64_t)) {
if (plain_len < (int32_t)(CRYPTO_PUBLIC_KEY_SIZE + sizeof(uint64_t))) {
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion toxcore/announce.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ static int create_reply(Announcements *announce, const IP_Port *source,
{
const int plain_len = (int)length - (1 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE + CRYPTO_MAC_SIZE);

if (plain_len < sizeof(uint64_t)) {
if (plain_len < (int)sizeof(uint64_t)) {
return -1;
}

Expand Down