[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] fix segfault when specifying DirServer without nickname



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	routerlist.c 
Log Message:
fix segfault when specifying DirServer without nickname
(reported by weasel)


Index: routerlist.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.402
retrieving revision 1.403
diff -u -p -d -r1.402 -r1.403
--- routerlist.c	15 Dec 2005 22:10:03 -0000	1.402
+++ routerlist.c	18 Dec 2005 22:45:27 -0000	1.403
@@ -2558,8 +2558,11 @@ add_trusted_dir_server(const char *nickn
 
   ent->fake_status.addr = ent->addr;
   memcpy(ent->fake_status.identity_digest, digest, DIGEST_LEN);
-  strlcpy(ent->fake_status.nickname, nickname,
-          sizeof(ent->fake_status.nickname));
+  if (nickname)
+    strlcpy(ent->fake_status.nickname, nickname,
+            sizeof(ent->fake_status.nickname));
+  else
+    ent->fake_status.nickname[0] = '\0';
   ent->fake_status.dir_port = ent->dir_port;
 
   smartlist_add(trusted_dir_servers, ent);