[or-cvs] r13136: Fixes to more anonymously-reported typos and logic errors. (in tor/trunk: . src/common src/or)

nickm at seul.org nickm at seul.org
Tue Jan 15 05:57:19 UTC 2008


Author: nickm
Date: 2008-01-15 00:57:19 -0500 (Tue, 15 Jan 2008)
New Revision: 13136

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/common/util.c
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/control.c
   tor/trunk/src/or/dirvote.c
   tor/trunk/src/or/eventdns.c
   tor/trunk/src/or/routerlist.c
Log:
 r17624 at catbus:  nickm | 2008-01-15 00:42:01 -0500
 Fixes to more anonymously-reported typos and logic errors.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r17624] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-01-15 05:57:14 UTC (rev 13135)
+++ tor/trunk/ChangeLog	2008-01-15 05:57:19 UTC (rev 13136)
@@ -50,6 +50,14 @@
     - Avoid segfault in the case where a badly behaved v2 versioning
       directory sends a signed networkstatus with missing client-versions.
       Bugfix on 0.1.2.
+    - Avoid segfaults on certain complex invocations of
+      router_get_by_hexdigest().  Bugfix on 0.1.2.
+    - Correct bad index on array access in parse_http_time().  Bugfix
+      on 0.2.0.
+    - Fix possible bug in vote generation when server versions are present
+      but client versions are not.
+    - Fix rare bug on REDIRECTSTREAM control command when called with no
+      port set: it could erroneously report an error when none had happened.
 
   o Minor features (controller):
     - Get NS events working again.  (Patch from tup)

Modified: tor/trunk/src/common/util.c
===================================================================
--- tor/trunk/src/common/util.c	2008-01-15 05:57:14 UTC (rev 13135)
+++ tor/trunk/src/common/util.c	2008-01-15 05:57:19 UTC (rev 13136)
@@ -1271,7 +1271,7 @@
     }
   }
 
-  month[4] = '\0';
+  month[3] = '\0';
   /* Okay, now decode the month. */
   for (i = 0; i < 12; ++i) {
     if (!strcasecmp(MONTH_NAMES[i], month)) {

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2008-01-15 05:57:14 UTC (rev 13135)
+++ tor/trunk/src/or/connection_edge.c	2008-01-15 05:57:19 UTC (rev 13136)
@@ -2304,6 +2304,7 @@
       address = tor_strdup(or_circ->p_conn->_base.address);
     else
       address = tor_strdup("127.0.0.1");
+    port = 1; /*XXXX020 set this to something sensible?  - NM*/
   } else {
     log_warn(LD_BUG, "Got an unexpected command %d", (int)rh.command);
     end_payload[0] = END_STREAM_REASON_INTERNAL;

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2008-01-15 05:57:14 UTC (rev 13135)
+++ tor/trunk/src/or/control.c	2008-01-15 05:57:19 UTC (rev 13136)
@@ -2325,7 +2325,7 @@
     connection_printf_to_buf(conn, "552 Unknown stream \"%s\"\r\n",
                              (char*)smartlist_get(args, 0));
   } else {
-    int ok;
+    int ok = 1;
     if (smartlist_len(args) > 2) { /* they included a port too */
       new_port = (uint16_t) tor_parse_ulong(smartlist_get(args, 2),
                                             10, 1, 65535, &ok, NULL);

Modified: tor/trunk/src/or/dirvote.c
===================================================================
--- tor/trunk/src/or/dirvote.c	2008-01-15 05:57:14 UTC (rev 13135)
+++ tor/trunk/src/or/dirvote.c	2008-01-15 05:57:19 UTC (rev 13136)
@@ -82,7 +82,7 @@
     char *cp;
     if (client_versions)
       v_len += strlen(client_versions);
-    if (client_versions)
+    if (server_versions)
       v_len += strlen(server_versions);
     version_lines = tor_malloc(v_len);
     cp = version_lines;

Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c	2008-01-15 05:57:14 UTC (rev 13135)
+++ tor/trunk/src/or/eventdns.c	2008-01-15 05:57:19 UTC (rev 13136)
@@ -2118,6 +2118,7 @@
 #else
 	fcntl(ns->socket, F_SETFL, O_NONBLOCK);
 #endif
+	memset(&sin, 0, sizeof(sin));
 	sin.sin_addr.s_addr = address;
 	sin.sin_port = htons(port);
 	sin.sin_family = AF_INET;

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2008-01-15 05:57:14 UTC (rev 13135)
+++ tor/trunk/src/or/routerlist.c	2008-01-15 05:57:19 UTC (rev 13136)
@@ -492,7 +492,6 @@
 static int
 router_rebuild_store(int force, desc_store_t *store)
 {
-  or_options_t *options;
   smartlist_t *chunk_list = NULL;
   char *fname = NULL, *fname_tmp = NULL;
   int r = -1;
@@ -518,8 +517,6 @@
 
   log_info(LD_DIR, "Rebuilding %s cache", store->description);
 
-  options = get_options();
-
   fname = get_datadir_fname(store->fname_base);
   fname_tmp = get_datadir_fname_suffix(store->fname_base, ".tmp");
 
@@ -1903,7 +1900,7 @@
 
   ri = router_get_by_digest(digest);
 
-  if (len > HEX_DIGEST_LEN) {
+  if (ri && len > HEX_DIGEST_LEN) {
     if (hexdigest[HEX_DIGEST_LEN] == '=') {
       if (strcasecmp(ri->nickname, hexdigest+HEX_DIGEST_LEN+1) ||
           !ri->is_named)



More information about the tor-commits mailing list