From 09d9d34a9300a7aab59ccde74a72cd54f4672599 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sat, 19 Apr 2014 17:50:10 -0400 Subject: [PATCH] Removed deprecated function from public api. Added upper length check to friendreq_handlepacket(). --- toxcore/friend_requests.c | 2 +- toxcore/tox.c | 11 ----------- toxcore/tox.h | 37 ------------------------------------- 3 files changed, 1 insertion(+), 49 deletions(-) diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c index 82e51a768..c5cfa4b4c 100644 --- a/toxcore/friend_requests.c +++ b/toxcore/friend_requests.c @@ -137,7 +137,7 @@ static int friendreq_handlepacket(void *object, uint8_t *source_pubkey, uint8_t { Friend_Requests *fr = object; - if (length <= 1 + sizeof(fr->nospam)) + if (length <= 1 + sizeof(fr->nospam) || length > MAX_DATA_SIZE) return 1; ++packet; diff --git a/toxcore/tox.c b/toxcore/tox.c index c07473dd9..d78ef091e 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c @@ -739,17 +739,6 @@ uint64_t tox_file_data_remaining(Tox *tox, int32_t friendnumber, uint8_t filenum /***************END OF FILE SENDING FUNCTIONS******************/ -/* Use these functions to bootstrap the client. - * Sends a get nodes request to the given node with ip port and public_key. - */ -void tox_bootstrap_from_ip(Tox *tox, tox_IP_Port _ip_port, uint8_t *public_key) -{ - Messenger *m = tox; - IP_Port ip_port; - memcpy(&ip_port, &_ip_port, sizeof(IP_Port)); - DHT_bootstrap(m->dht, ip_port, public_key); -} - int tox_bootstrap_from_address(Tox *tox, const char *address, uint8_t ipv6enabled, uint16_t port, uint8_t *public_key) { diff --git a/toxcore/tox.h b/toxcore/tox.h index d94c0e139..fadd1a281 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -601,43 +601,6 @@ uint64_t tox_file_data_remaining(Tox *tox, int32_t friendnumber, uint8_t filenum /***************END OF FILE SENDING FUNCTIONS******************/ -/* WARNING: DEPRECATED, DO NOT USE. */ -typedef union { - uint8_t c[4]; - uint16_t s[2]; - uint32_t i; -} tox_IP4; - -typedef union { - uint8_t uint8[16]; - uint16_t uint16[8]; - uint32_t uint32[4]; - struct in6_addr in6_addr; -} tox_IP6; - -typedef struct { - uint8_t family; - /* Not used for anything right now. */ - uint8_t padding[3]; - union { - tox_IP4 ip4; - tox_IP6 ip6; - }; -} tox_IP; - -/* will replace IP_Port as soon as the complete infrastructure is in place - * removed the unused union and padding also */ -typedef struct { - tox_IP ip; - uint16_t port; -} tox_IP_Port; -/* WARNING: DEPRECATED, DO NOT USE. */ -/* Sends a "get nodes" request to the given node with ip, port and public_key - * to setup connections - */ -void tox_bootstrap_from_ip(Tox *tox, tox_IP_Port ip_port, uint8_t *public_key); - - /* * Use this function to bootstrap the client. */