[or-cvs] stop taking strlen of an uninitialized buffer

Roger Dingledine arma at seul.org
Wed Aug 18 09:49:19 UTC 2004


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

Modified Files:
	rephist.c 
Log Message:
stop taking strlen of an uninitialized buffer
we were (are?) printing garbage in the rephist stats


Index: rephist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rephist.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rephist.c	17 Aug 2004 07:14:45 -0000	1.26
+++ rephist.c	18 Aug 2004 09:49:17 -0000	1.27
@@ -266,9 +266,10 @@
         or_history->n_conn_ok, or_history->n_conn_fail+or_history->n_conn_ok,
         upt, upt+downt, uptime*100.0);
 
-    if (!strmap_isempty(or_history->link_history_map)) {
+    if (!strmap_isempty(or_history->link_history_map))
       strcpy(buffer, "    Good extend attempts: ");
-    }
+    else
+      *buffer = '\0';
     len = strlen(buffer);
     for (lhist_it = strmap_iter_init(or_history->link_history_map);
          !strmap_iter_done(lhist_it);



More information about the tor-commits mailing list