summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-09 02:35:43 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-09 02:35:43 +0000
commitc34125503493b2a71728c1cc5e913744f797704e (patch)
treeb489c737dcc55b85848d99e9d5e79362bb56ed59 /src
parentc198b6d87e373c8716f18393e8b6735749dfdb1d (diff)
downloadtor-c34125503493b2a71728c1cc5e913744f797704e.tar.gz
tor-c34125503493b2a71728c1cc5e913744f797704e.zip
r8956@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. svn:r8663
Diffstat (limited to 'src')
-rw-r--r--src/or/control.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c
index dc9cb60b96..f3fafff8bf 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -490,6 +490,10 @@ connection_printf_to_buf(control_connection_t *conn, const char *format, ...)
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 @@ send_control1_event(uint16_t event, name_type_t which, const char *format, ...)
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 @@ control_event_descriptors_changed(smartlist_t *routers)
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);