Be on the safe side with initialisation of c->name.

This commit is contained in:
Guus Sliepen 2005-05-04 15:51:45 +00:00
parent 92c4a28d7d
commit dc09f6fe89
2 changed files with 6 additions and 3 deletions

View file

@ -424,6 +424,7 @@ bool handle_new_meta_connection(int sock)
sockaddrunmap(&sa); sockaddrunmap(&sa);
c = new_connection(); c = new_connection();
c->name = NULL;
c->outcipher = myself->connection->outcipher; c->outcipher = myself->connection->outcipher;
c->outdigest = myself->connection->outdigest; c->outdigest = myself->connection->outdigest;
c->outmaclength = myself->connection->outmaclength; c->outmaclength = myself->connection->outmaclength;
@ -462,8 +463,7 @@ void try_outgoing_connections(void)
cp(); cp();
for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
cfg = lookup_config_next(config_tree, cfg)) {
get_config_string(cfg, &name); get_config_string(cfg, &name);
if(!check_id(name)) { if(!check_id(name)) {

View file

@ -76,8 +76,11 @@ bool id_h(connection_t *c)
c->name); c->name);
return false; return false;
} }
} else } else {
if(c->name)
free(c->name);
c->name = xstrdup(name); c->name = xstrdup(name);
}
/* Check if version matches */ /* Check if version matches */