From: Guus Sliepen Date: Wed, 4 May 2005 15:51:45 +0000 (+0000) Subject: Be on the safe side with initialisation of c->name. X-Git-Tag: release-1.0.4~5 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=dc09f6fe896f5e35fffe8cc2004781b2e1b6fd5a;p=tinc Be on the safe side with initialisation of c->name. --- diff --git a/src/net_socket.c b/src/net_socket.c index 9095d575..dbd09dd4 100644 --- a/src/net_socket.c +++ b/src/net_socket.c @@ -424,6 +424,7 @@ bool handle_new_meta_connection(int sock) sockaddrunmap(&sa); c = new_connection(); + c->name = NULL; c->outcipher = myself->connection->outcipher; c->outdigest = myself->connection->outdigest; c->outmaclength = myself->connection->outmaclength; @@ -462,8 +463,7 @@ void try_outgoing_connections(void) cp(); - for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; - cfg = lookup_config_next(config_tree, cfg)) { + for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) { get_config_string(cfg, &name); if(!check_id(name)) { diff --git a/src/protocol_auth.c b/src/protocol_auth.c index 214d4dd5..05f547f2 100644 --- a/src/protocol_auth.c +++ b/src/protocol_auth.c @@ -76,8 +76,11 @@ bool id_h(connection_t *c) c->name); return false; } - } else + } else { + if(c->name) + free(c->name); c->name = xstrdup(name); + } /* Check if version matches */