[or-cvs] r8663: Fix bug with handling EVENT_NEW_DESC with verbose nicknames (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Mon Oct 9 02:35:47 UTC 2006


Author: nickm
Date: 2006-10-08 22:35:43 -0400 (Sun, 08 Oct 2006)
New Revision: 8663

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/control.c
Log:
 r8956 at totoro:  nickm | 2006-10-08 22:25:27 -0400
 Fix bug with handling EVENT_NEW_DESC with verbose nicknames enabled.  Also, check for tor_vsnprintf failure in controller messages.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r8956] on 96637b51-b116-0410-a10e-9941ebb49b64

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-10-09 02:35:32 UTC (rev 8662)
+++ tor/trunk/ChangeLog	2006-10-09 02:35:43 UTC (rev 8663)
@@ -6,6 +6,8 @@
       chews through many circuits before giving up.
     - In the hidden service example in torrc.sample, stop recommending
       esoteric and discouraged hidden service options.
+    - Avoid sending junk to controllers or segfaulting when a controller
+      uses EVENT_NEW_DESC with verbose nicknames.
 
 
 Changes in version 0.1.2.2-alpha - 2006-10-07

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2006-10-09 02:35:32 UTC (rev 8662)
+++ tor/trunk/src/or/control.c	2006-10-09 02:35:43 UTC (rev 8663)
@@ -490,6 +490,10 @@
   va_start(ap,format);
   r = tor_vsnprintf(buf, sizeof(buf), format, ap);
   va_end(ap);
+  if (r<0) {
+    log_warn(LD_BUG, "Unable to format string for controller.");
+    return;
+  }
   len = strlen(buf);
   if (memcmp("\r\n\0", buf+len-2, 3)) {
     buf[CONNECTION_PRINTF_TO_BUF_BUFFERSIZE-1] = '\0';
@@ -659,6 +663,10 @@
   va_start(ap, format);
   r = tor_vsnprintf(buf, sizeof(buf), format, ap);
   va_end(ap);
+  if (r<0) {
+    log_warn(LD_BUG, "Unable to format event for controller.");
+    return;
+  }
 
   len = strlen(buf);
   if (memcmp("\r\n\0", buf+len-2, 3)) {
@@ -3076,6 +3084,7 @@
     size_t len;
     SMARTLIST_FOREACH(routers, routerinfo_t *, ri, {
         char *b = tor_malloc(MAX_VERBOSE_NICKNAME_LEN+1);
+        router_get_verbose_nickname(b, ri);
         smartlist_add(names, b);
       });
     ids = smartlist_join_strings(names, " ", 0, &len);



More information about the tor-commits mailing list