[tor-commits] [tor/master] Stop silently skipping invalid args to setevents

arma at torproject.org arma at torproject.org
Sun Sep 21 20:11:16 UTC 2014


commit 1b40ea036fa6e0c4063e096ccc52d47c1227710f
Author: Roger Dingledine <arma at torproject.org>
Date:   Sun Sep 21 01:23:39 2014 -0400

    Stop silently skipping invalid args to setevents
    
    Return an error when the second or later arguments of the
    "setevents" controller command are invalid events. Previously we
    would return success while silently skipping invalid events.
    
    Fixes bug 13205; bugfix on 0.2.3.2-alpha. Reported by "fpxnns".
---
 changes/bug13205 |    5 +++++
 src/or/control.c |    4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/changes/bug13205 b/changes/bug13205
new file mode 100644
index 0000000..446ffcf
--- /dev/null
+++ b/changes/bug13205
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Return an error when the second or later arguments of the
+      "setevents" controller command are invalid events. Previously we
+      would return success while silently skipping invalid events. Fixes
+      bug 13205; bugfix on 0.2.3.2-alpha. Reported by "fpxnns".
diff --git a/src/or/control.c b/src/or/control.c
index 7038b2c..df69493 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -949,7 +949,7 @@ static int
 handle_control_setevents(control_connection_t *conn, uint32_t len,
                          const char *body)
 {
-  int event_code = -1;
+  int event_code;
   event_mask_t event_mask = 0;
   smartlist_t *events = smartlist_new();
 
@@ -963,6 +963,8 @@ handle_control_setevents(control_connection_t *conn, uint32_t len,
         continue;
       } else {
         int i;
+        event_code = -1;
+
         for (i = 0; control_event_table[i].event_name != NULL; ++i) {
           if (!strcasecmp(ev, control_event_table[i].event_name)) {
             event_code = control_event_table[i].event_code;



More information about the tor-commits mailing list