]> git.meshlink.io Git - meshlink/commitdiff
Be on the safe side with initialisation of c->name.
authorGuus Sliepen <guus@tinc-vpn.org>
Wed, 4 May 2005 15:51:45 +0000 (15:51 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Wed, 4 May 2005 15:51:45 +0000 (15:51 +0000)
src/net_socket.c
src/protocol_auth.c

index 9095d575c6a0caa633ab5bb9e5ffc64897ee7412..dbd09dd4e75b9da72b9640c898a65979405d3f69 100644 (file)
@@ -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)) {
index 214d4dd5ed1fc960fc64853164b6cffeb196581d..05f547f22ac5b8ae2f751b8c2023fc9af3ebe07f 100644 (file)
@@ -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 */