From a6e3e443c5b788c7d1b43a1f9118d772a5a18f8d Mon Sep 17 00:00:00 2001 From: GDR! Date: Tue, 6 Feb 2018 12:57:33 +0100 Subject: [PATCH] Attempt at fixing double-free in issue #50 --- gitversion.h | 2 +- main.c | 21 ++++++++++++ tox_bootstrap.h | 91 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 81 insertions(+), 33 deletions(-) diff --git a/gitversion.h b/gitversion.h index e3b5b7f..988e1e8 100644 --- a/gitversion.h +++ b/gitversion.h @@ -1 +1 @@ -#define GITVERSION "0.0.8" +#define GITVERSION "b8c2242cafe33bda19c9774e2584be7508cb35f0" diff --git a/main.c b/main.c index a16c040..2581a20 100644 --- a/main.c +++ b/main.c @@ -161,10 +161,31 @@ void tunnel_delete(tunnel *t) free(t); } +int tunnel_in_delete_queue(tunnel *t) +{ + tunnel_list *element; + + LL_FOREACH(tunnels_to_delete, element) + { + if(element->tun == t) + { + return 1; + } + } + + return 0; +} + void tunnel_queue_delete(tunnel *t) { tunnel_list *tunnel_list_entry = NULL; + if(tunnel_in_delete_queue(t)) + { + log_printf(L_DEBUG2, "Did not queue deleting tunnel #%d ptr %p - already queued\n", t->connid, t); + return; + } + log_printf(L_DEBUG2, "Queued deleting tunnel #%d ptr %p\n", t->connid, t); tunnel_list_entry = calloc(sizeof(tunnel_list), 1); diff --git a/tox_bootstrap.h b/tox_bootstrap.h index c9db74b..4f38cea 100644 --- a/tox_bootstrap.h +++ b/tox_bootstrap.h @@ -1,7 +1,7 @@ /* * Generated with generate_tox_bootstrap.py by GDR! - * from https://nodes.tox.chat/json on 2017-11-01 11:46:00.424767 + * from https://nodes.tox.chat/json on 2017-11-01 16:54:15.375805 */ struct bootstrap_node { char *address; @@ -153,6 +153,24 @@ struct bootstrap_node { } }, + { + "92.54.84.70", + 33445, + { + 0x56, 0x25, 0xA6, 0x26, 0x18, 0xCB, 0x4F, 0xCA, 0x70, 0xE1, 0x47, 0xA7, 0x1B, 0x29, 0x69, 0x5F, + 0x38, 0xCC, 0x65, 0xFF, 0x0C, 0xBD, 0x68, 0xAD, 0x46, 0x25, 0x45, 0x85, 0xBE, 0x56, 0x48, 0x02 + } + }, + + { + "195.93.190.6", + 33445, + { + 0xFB, 0x4C, 0xE0, 0xDD, 0xEF, 0xEE, 0xD4, 0x5F, 0x26, 0x91, 0x70, 0x53, 0xE5, 0xD2, 0x4B, 0xDD, + 0xA0, 0xFA, 0x0A, 0x3D, 0x83, 0xA6, 0x72, 0xA9, 0xDA, 0x23, 0x75, 0x92, 0x8B, 0x37, 0x02, 0x3D + } + }, + { "174.127.245.27", 33445, @@ -428,7 +446,7 @@ struct bootstrap_node tcp_relays[] = { { "198.46.138.44", - 33445, + 3389, { 0xF4, 0x04, 0xAB, 0xAA, 0x1C, 0x99, 0xA9, 0xD3, 0x7D, 0x61, 0xAB, 0x54, 0x89, 0x8F, 0x56, 0x79, 0x3E, 0x1D, 0xEF, 0x8B, 0xD4, 0x6B, 0x10, 0x38, 0xB9, 0xD8, 0x22, 0xE8, 0x46, 0x0F, 0xAB, 0x67 @@ -437,7 +455,7 @@ struct bootstrap_node tcp_relays[] = { { "198.46.138.44", - 3389, + 33445, { 0xF4, 0x04, 0xAB, 0xAA, 0x1C, 0x99, 0xA9, 0xD3, 0x7D, 0x61, 0xAB, 0x54, 0x89, 0x8F, 0x56, 0x79, 0x3E, 0x1D, 0xEF, 0x8B, 0xD4, 0x6B, 0x10, 0x38, 0xB9, 0xD8, 0x22, 0xE8, 0x46, 0x0F, 0xAB, 0x67 @@ -446,7 +464,7 @@ struct bootstrap_node tcp_relays[] = { { "51.15.37.145", - 3389, + 33445, { 0x6F, 0xC4, 0x1E, 0x2B, 0xD3, 0x81, 0xD3, 0x7E, 0x97, 0x48, 0xFC, 0x0E, 0x03, 0x28, 0xCE, 0x08, 0x6A, 0xF9, 0x59, 0x8B, 0xEC, 0xC8, 0xFE, 0xB7, 0xDD, 0xF2, 0xE4, 0x40, 0x47, 0x5F, 0x30, 0x0E @@ -455,7 +473,7 @@ struct bootstrap_node tcp_relays[] = { { "51.15.37.145", - 33445, + 3389, { 0x6F, 0xC4, 0x1E, 0x2B, 0xD3, 0x81, 0xD3, 0x7E, 0x97, 0x48, 0xFC, 0x0E, 0x03, 0x28, 0xCE, 0x08, 0x6A, 0xF9, 0x59, 0x8B, 0xEC, 0xC8, 0xFE, 0xB7, 0xDD, 0xF2, 0xE4, 0x40, 0x47, 0x5F, 0x30, 0x0E @@ -518,7 +536,7 @@ struct bootstrap_node tcp_relays[] = { { "194.249.212.109", - 33445, + 3389, { 0x3C, 0xEE, 0x1F, 0x05, 0x40, 0x81, 0xE7, 0xA0, 0x11, 0x23, 0x48, 0x83, 0xBC, 0x4F, 0xC3, 0x9F, 0x66, 0x1A, 0x55, 0xB7, 0x36, 0x37, 0xA5, 0xAC, 0x29, 0x3D, 0xDF, 0x12, 0x51, 0xD9, 0x43, 0x2B @@ -527,7 +545,7 @@ struct bootstrap_node tcp_relays[] = { { "194.249.212.109", - 3389, + 33445, { 0x3C, 0xEE, 0x1F, 0x05, 0x40, 0x81, 0xE7, 0xA0, 0x11, 0x23, 0x48, 0x83, 0xBC, 0x4F, 0xC3, 0x9F, 0x66, 0x1A, 0x55, 0xB7, 0x36, 0x37, 0xA5, 0xAC, 0x29, 0x3D, 0xDF, 0x12, 0x51, 0xD9, 0x43, 0x2B @@ -554,7 +572,7 @@ struct bootstrap_node tcp_relays[] = { { "5.189.176.217", - 5190, + 3389, { 0x2B, 0x21, 0x37, 0xE0, 0x94, 0xF7, 0x43, 0xAC, 0x8B, 0xD4, 0x46, 0x52, 0xC5, 0x5F, 0x41, 0xDF, 0xAC, 0xC5, 0x02, 0xF1, 0x25, 0xE9, 0x9E, 0x4F, 0xE2, 0x4D, 0x40, 0x53, 0x74, 0x89, 0xE3, 0x2F @@ -572,7 +590,7 @@ struct bootstrap_node tcp_relays[] = { { "5.189.176.217", - 3389, + 5190, { 0x2B, 0x21, 0x37, 0xE0, 0x94, 0xF7, 0x43, 0xAC, 0x8B, 0xD4, 0x46, 0x52, 0xC5, 0x5F, 0x41, 0xDF, 0xAC, 0xC5, 0x02, 0xF1, 0x25, 0xE9, 0x9E, 0x4F, 0xE2, 0x4D, 0x40, 0x53, 0x74, 0x89, 0xE3, 0x2F @@ -590,7 +608,7 @@ struct bootstrap_node tcp_relays[] = { { "217.182.143.254", - 33445, + 443, { 0x7A, 0xED, 0x21, 0xF9, 0x4D, 0x82, 0xB0, 0x57, 0x74, 0xF6, 0x97, 0xB2, 0x09, 0x62, 0x8C, 0xD5, 0xA9, 0xAD, 0x17, 0xE0, 0xC0, 0x73, 0xD9, 0x32, 0x90, 0x76, 0xA4, 0xC2, 0x8E, 0xD2, 0x81, 0x47 @@ -599,7 +617,7 @@ struct bootstrap_node tcp_relays[] = { { "217.182.143.254", - 443, + 33445, { 0x7A, 0xED, 0x21, 0xF9, 0x4D, 0x82, 0xB0, 0x57, 0x74, 0xF6, 0x97, 0xB2, 0x09, 0x62, 0x8C, 0xD5, 0xA9, 0xAD, 0x17, 0xE0, 0xC0, 0x73, 0xD9, 0x32, 0x90, 0x76, 0xA4, 0xC2, 0x8E, 0xD2, 0x81, 0x47 @@ -653,7 +671,7 @@ struct bootstrap_node tcp_relays[] = { { "51.254.84.212", - 3389, + 33445, { 0xAE, 0xC2, 0x04, 0xB9, 0xA4, 0x50, 0x14, 0x12, 0xD5, 0xF0, 0xBB, 0x67, 0xD9, 0xC8, 0x1B, 0x5D, 0xB3, 0xEE, 0x6A, 0xDA, 0x64, 0x12, 0x2D, 0x32, 0xA3, 0xE9, 0xB0, 0x93, 0xD5, 0x44, 0x32, 0x7D @@ -662,7 +680,7 @@ struct bootstrap_node tcp_relays[] = { { "51.254.84.212", - 33445, + 3389, { 0xAE, 0xC2, 0x04, 0xB9, 0xA4, 0x50, 0x14, 0x12, 0xD5, 0xF0, 0xBB, 0x67, 0xD9, 0xC8, 0x1B, 0x5D, 0xB3, 0xEE, 0x6A, 0xDA, 0x64, 0x12, 0x2D, 0x32, 0xA3, 0xE9, 0xB0, 0x93, 0xD5, 0x44, 0x32, 0x7D @@ -671,7 +689,7 @@ struct bootstrap_node tcp_relays[] = { { "88.99.133.52", - 3389, + 33445, { 0x2D, 0x32, 0x0F, 0x97, 0x1E, 0xF2, 0xCA, 0x18, 0x00, 0x44, 0x16, 0xC2, 0xAA, 0xE7, 0xBA, 0x52, 0xBF, 0x79, 0x49, 0xDB, 0x34, 0xEA, 0x8E, 0x2E, 0x21, 0xAF, 0x67, 0xBD, 0x36, 0x7B, 0xE2, 0x11 @@ -680,7 +698,7 @@ struct bootstrap_node tcp_relays[] = { { "88.99.133.52", - 33445, + 3389, { 0x2D, 0x32, 0x0F, 0x97, 0x1E, 0xF2, 0xCA, 0x18, 0x00, 0x44, 0x16, 0xC2, 0xAA, 0xE7, 0xBA, 0x52, 0xBF, 0x79, 0x49, 0xDB, 0x34, 0xEA, 0x8E, 0x2E, 0x21, 0xAF, 0x67, 0xBD, 0x36, 0x7B, 0xE2, 0x11 @@ -705,6 +723,15 @@ struct bootstrap_node tcp_relays[] = { } }, + { + "195.93.190.6", + 33445, + { + 0xFB, 0x4C, 0xE0, 0xDD, 0xEF, 0xEE, 0xD4, 0x5F, 0x26, 0x91, 0x70, 0x53, 0xE5, 0xD2, 0x4B, 0xDD, + 0xA0, 0xFA, 0x0A, 0x3D, 0x83, 0xA6, 0x72, 0xA9, 0xDA, 0x23, 0x75, 0x92, 0x8B, 0x37, 0x02, 0x3D + } + }, + { "174.127.245.27", 33445, @@ -806,7 +833,7 @@ struct bootstrap_node tcp_relays[] = { { "80.87.193.193", - 33445, + 3389, { 0xB3, 0x82, 0x55, 0xEE, 0x4B, 0x05, 0x49, 0x24, 0xF6, 0xD7, 0x9A, 0x5E, 0x6E, 0x58, 0x89, 0xEC, 0x94, 0xB6, 0xAD, 0xF6, 0xFE, 0x99, 0x06, 0xF9, 0x7A, 0x3D, 0x01, 0xE3, 0xD0, 0x83, 0x22, 0x3A @@ -815,7 +842,7 @@ struct bootstrap_node tcp_relays[] = { { "80.87.193.193", - 3389, + 33445, { 0xB3, 0x82, 0x55, 0xEE, 0x4B, 0x05, 0x49, 0x24, 0xF6, 0xD7, 0x9A, 0x5E, 0x6E, 0x58, 0x89, 0xEC, 0x94, 0xB6, 0xAD, 0xF6, 0xFE, 0x99, 0x06, 0xF9, 0x7A, 0x3D, 0x01, 0xE3, 0xD0, 0x83, 0x22, 0x3A @@ -869,7 +896,7 @@ struct bootstrap_node tcp_relays[] = { { "5.9.77.5", - 3389, + 33445, { 0xA8, 0x56, 0x24, 0x30, 0x58, 0xD1, 0xDE, 0x63, 0x33, 0x79, 0x50, 0x8A, 0xDC, 0xAF, 0xCF, 0x94, 0x4E, 0x40, 0xE1, 0x67, 0x2F, 0xF4, 0x02, 0x75, 0x0E, 0xF7, 0x12, 0xE3, 0x0C, 0x42, 0x01, 0x2A @@ -878,7 +905,7 @@ struct bootstrap_node tcp_relays[] = { { "5.9.77.5", - 33445, + 3389, { 0xA8, 0x56, 0x24, 0x30, 0x58, 0xD1, 0xDE, 0x63, 0x33, 0x79, 0x50, 0x8A, 0xDC, 0xAF, 0xCF, 0x94, 0x4E, 0x40, 0xE1, 0x67, 0x2F, 0xF4, 0x02, 0x75, 0x0E, 0xF7, 0x12, 0xE3, 0x0C, 0x42, 0x01, 0x2A @@ -941,7 +968,7 @@ struct bootstrap_node tcp_relays[] = { { "37.187.122.30", - 3389, + 33445, { 0xBE, 0xB7, 0x1F, 0x97, 0xED, 0x9C, 0x99, 0xC0, 0x4B, 0x84, 0x89, 0xBB, 0x75, 0x57, 0x9E, 0xB4, 0xDC, 0x6A, 0xB6, 0xF4, 0x41, 0xB6, 0x03, 0xD6, 0x35, 0x33, 0x12, 0x2F, 0x18, 0x58, 0xB5, 0x1D @@ -950,7 +977,7 @@ struct bootstrap_node tcp_relays[] = { { "37.187.122.30", - 33445, + 3389, { 0xBE, 0xB7, 0x1F, 0x97, 0xED, 0x9C, 0x99, 0xC0, 0x4B, 0x84, 0x89, 0xBB, 0x75, 0x57, 0x9E, 0xB4, 0xDC, 0x6A, 0xB6, 0xF4, 0x41, 0xB6, 0x03, 0xD6, 0x35, 0x33, 0x12, 0x2F, 0x18, 0x58, 0xB5, 0x1D @@ -959,7 +986,7 @@ struct bootstrap_node tcp_relays[] = { { "136.243.141.187", - 33445, + 3389, { 0x6E, 0xE1, 0xFA, 0xDE, 0x9F, 0x55, 0xCC, 0x79, 0x38, 0x23, 0x4C, 0xC0, 0x7C, 0x86, 0x40, 0x81, 0xFC, 0x60, 0x6D, 0x8F, 0xE7, 0xB7, 0x51, 0xED, 0xA2, 0x17, 0xF2, 0x68, 0xF1, 0x07, 0x8A, 0x39 @@ -968,7 +995,7 @@ struct bootstrap_node tcp_relays[] = { { "136.243.141.187", - 3389, + 443, { 0x6E, 0xE1, 0xFA, 0xDE, 0x9F, 0x55, 0xCC, 0x79, 0x38, 0x23, 0x4C, 0xC0, 0x7C, 0x86, 0x40, 0x81, 0xFC, 0x60, 0x6D, 0x8F, 0xE7, 0xB7, 0x51, 0xED, 0xA2, 0x17, 0xF2, 0x68, 0xF1, 0x07, 0x8A, 0x39 @@ -977,7 +1004,7 @@ struct bootstrap_node tcp_relays[] = { { "136.243.141.187", - 443, + 33445, { 0x6E, 0xE1, 0xFA, 0xDE, 0x9F, 0x55, 0xCC, 0x79, 0x38, 0x23, 0x4C, 0xC0, 0x7C, 0x86, 0x40, 0x81, 0xFC, 0x60, 0x6D, 0x8F, 0xE7, 0xB7, 0x51, 0xED, 0xA2, 0x17, 0xF2, 0x68, 0xF1, 0x07, 0x8A, 0x39 @@ -995,7 +1022,7 @@ struct bootstrap_node tcp_relays[] = { { "95.215.46.114", - 3389, + 33445, { 0x58, 0x23, 0xFB, 0x94, 0x7F, 0xF2, 0x4C, 0xF8, 0x3D, 0xDF, 0xAC, 0x3F, 0x3B, 0xAA, 0x18, 0xF9, 0x6E, 0xA2, 0x01, 0x8B, 0x16, 0xCC, 0x08, 0x42, 0x9C, 0xB9, 0x7F, 0xA5, 0x02, 0xF4, 0x0C, 0x23 @@ -1004,7 +1031,7 @@ struct bootstrap_node tcp_relays[] = { { "95.215.46.114", - 33445, + 3389, { 0x58, 0x23, 0xFB, 0x94, 0x7F, 0xF2, 0x4C, 0xF8, 0x3D, 0xDF, 0xAC, 0x3F, 0x3B, 0xAA, 0x18, 0xF9, 0x6E, 0xA2, 0x01, 0x8B, 0x16, 0xCC, 0x08, 0x42, 0x9C, 0xB9, 0x7F, 0xA5, 0x02, 0xF4, 0x0C, 0x23 @@ -1031,7 +1058,7 @@ struct bootstrap_node tcp_relays[] = { { "192.99.232.158", - 33445, + 3389, { 0x7B, 0x6C, 0xB2, 0x08, 0xC8, 0x11, 0xDE, 0xA8, 0x78, 0x27, 0x11, 0xCE, 0x0C, 0xAD, 0x45, 0x6A, 0xAC, 0x0C, 0x7B, 0x16, 0x5A, 0x04, 0x98, 0xA1, 0xAA, 0x70, 0x10, 0xD2, 0xF2, 0xEC, 0x99, 0x6C @@ -1040,7 +1067,7 @@ struct bootstrap_node tcp_relays[] = { { "192.99.232.158", - 3389, + 33445, { 0x7B, 0x6C, 0xB2, 0x08, 0xC8, 0x11, 0xDE, 0xA8, 0x78, 0x27, 0x11, 0xCE, 0x0C, 0xAD, 0x45, 0x6A, 0xAC, 0x0C, 0x7B, 0x16, 0x5A, 0x04, 0x98, 0xA1, 0xAA, 0x70, 0x10, 0xD2, 0xF2, 0xEC, 0x99, 0x6C @@ -1058,7 +1085,7 @@ struct bootstrap_node tcp_relays[] = { { "37.48.122.22", - 33445, + 3389, { 0x1B, 0x5A, 0x8A, 0xB2, 0x5F, 0xFF, 0xB6, 0x66, 0x20, 0xA5, 0x31, 0xC4, 0x64, 0x6B, 0x47, 0xF0, 0xF3, 0x2B, 0x74, 0xC5, 0x47, 0xB3, 0x0A, 0xF8, 0xBD, 0x82, 0x66, 0xCA, 0x50, 0xA3, 0xAB, 0x59 @@ -1067,7 +1094,7 @@ struct bootstrap_node tcp_relays[] = { { "37.48.122.22", - 3389, + 33445, { 0x1B, 0x5A, 0x8A, 0xB2, 0x5F, 0xFF, 0xB6, 0x66, 0x20, 0xA5, 0x31, 0xC4, 0x64, 0x6B, 0x47, 0xF0, 0xF3, 0x2B, 0x74, 0xC5, 0x47, 0xB3, 0x0A, 0xF8, 0xBD, 0x82, 0x66, 0xCA, 0x50, 0xA3, 0xAB, 0x59 @@ -1076,7 +1103,7 @@ struct bootstrap_node tcp_relays[] = { { "5.79.75.37", - 33445, + 3389, { 0xD5, 0x27, 0xE5, 0x84, 0x7F, 0x83, 0x30, 0xD6, 0x28, 0xDA, 0xB1, 0x81, 0x4F, 0x0A, 0x42, 0x2F, 0x6D, 0xC9, 0xD0, 0xA3, 0x00, 0xE6, 0xC3, 0x57, 0x63, 0x4E, 0xE2, 0xDA, 0x88, 0xC3, 0x54, 0x63 @@ -1085,7 +1112,7 @@ struct bootstrap_node tcp_relays[] = { { "5.79.75.37", - 3389, + 33445, { 0xD5, 0x27, 0xE5, 0x84, 0x7F, 0x83, 0x30, 0xD6, 0x28, 0xDA, 0xB1, 0x81, 0x4F, 0x0A, 0x42, 0x2F, 0x6D, 0xC9, 0xD0, 0xA3, 0x00, 0xE6, 0xC3, 0x57, 0x63, 0x4E, 0xE2, 0xDA, 0x88, 0xC3, 0x54, 0x63