From dc09f6fe896f5e35fffe8cc2004781b2e1b6fd5a Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 4 May 2005 15:51:45 +0000 Subject: [PATCH] Be on the safe side with initialisation of c->name. --- src/net_socket.c | 4 ++-- src/protocol_auth.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/net_socket.c b/src/net_socket.c index 9095d57..dbd09dd 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 214d4dd..05f547f 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 */ -- 2.25.1