]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Stop silently skipping invalid args to setevents
authorRoger Dingledine <arma@torproject.org>
Sun, 21 Sep 2014 05:23:39 +0000 (01:23 -0400)
committerRoger Dingledine <arma@torproject.org>
Sun, 21 Sep 2014 20:05:24 +0000 (16:05 -0400)
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 [new file with mode: 0644]
src/or/control.c

diff --git a/changes/bug13205 b/changes/bug13205
new file mode 100644 (file)
index 0000000..446ffcf
--- /dev/null
@@ -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".
index 7038b2cfd594b2bdc8b2e46f33db160080e49ece..df694930bdf67ac8ea7d7247c8573a05288f128f 100644 (file)
@@ -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;