commit f2a6eedded9d4dc3c854c1e3091d1f6278ac6e7f
Author: Nick Mathewson <[email protected]>
Date:   Mon May 7 15:22:17 2012 -0400

    Fix a crash bug on SETCIRCUITPURPOSE.
---
 changes/bug5796  |    4 ++++
 src/or/control.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/changes/bug5796 b/changes/bug5796
new file mode 100644
index 0000000..b92659f
--- /dev/null
+++ b/changes/bug5796
@@ -0,0 +1,4 @@
+  o Minor bugfixes (controller):
+    - Fix a NULL-pointer derefernce on a badly formed
+      SETCIRCUITPURPOSE command. Found by mikeyc. Fixes bug 5796;
+      bugfix on 0.2.2.9-alpha.
diff --git a/src/or/control.c b/src/or/control.c
index ddfc80e..b41b291 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2389,6 +2389,10 @@ handle_control_setcircuitpurpose(control_connection_t 
*conn,
 
   {
     const char *purp = find_element_starting_with(args,1,"PURPOSE=");
+    if (!purp) {
+      connection_write_str_to_buf("552 No purpose given\r\n", conn);
+      goto done;
+    }
     new_purpose = circuit_purpose_from_string(purp);
     if (new_purpose == CIRCUIT_PURPOSE_UNKNOWN) {
       connection_printf_to_buf(conn, "552 Unknown purpose \"%s\"\r\n", purp);



_______________________________________________
tor-commits mailing list
[email protected]
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to