diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index d89b157c..1bd11a1d 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c @@ -87,7 +87,7 @@ static int proxy_http_generate_connection_request(TCP_Client_Connection *TCP_con const int written = snprintf((char *)TCP_conn->last_packet, MAX_PACKET_SIZE, "%s%s:%hu%s%s:%hu%s", one, ip, port, two, ip, port, three); - if (written < 0) { + if (written < 0 || MAX_PACKET_SIZE < written) { return 0; } diff --git a/toxcore/onion.c b/toxcore/onion.c index c6093f0c..48e4c769 100644 --- a/toxcore/onion.c +++ b/toxcore/onion.c @@ -35,8 +35,8 @@ #define SEND_2 ONION_SEND_2 #define SEND_1 ONION_SEND_1 -/* Change symmetric keys every hour to make paths expire eventually. */ -#define KEY_REFRESH_INTERVAL (60 * 60) +/* Change symmetric keys every 2 hours to make paths expire eventually. */ +#define KEY_REFRESH_INTERVAL (2 * 60 * 60) static void change_symmetric_key(Onion *onion) { if (is_timeout(onion->timestamp, KEY_REFRESH_INTERVAL)) {