[tor-commits] [tor/master] Don't follow the NULL pointer.

nickm at torproject.org nickm at torproject.org
Mon Sep 10 14:22:40 UTC 2012


commit 93ee62297ff24fcd01f97c87d76953f4d5fb377c
Author: Linus Nordberg <linus at torproject.org>
Date:   Wed Sep 5 14:00:55 2012 +0200

    Don't follow the NULL pointer.
    
    If dirvote_create_microdescriptor() returns NULL, don't use md.
    
    Found by "f. tp.".
    
    Fixes bug 6797.
---
 changes/bug6797  |    3 +++
 src/or/dirserv.c |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/changes/bug6797 b/changes/bug6797
new file mode 100644
index 0000000..f52f899
--- /dev/null
+++ b/changes/bug6797
@@ -0,0 +1,3 @@
+  o Minor bugfixes:
+    - Don't follow the NULL pointer. Found by "f. tp.". Fixes bug
+      6797; bugfix on 0.2.4.1-alpha.
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 7f46906..e7a2623 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2800,9 +2800,9 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
           h->microdesc_hash_line = tor_strdup(buf);
           h->next = vrs->microdesc;
           vrs->microdesc = h;
+          md->last_listed = now;
+          smartlist_add(microdescriptors, md);
         }
-        md->last_listed = now;
-        smartlist_add(microdescriptors, md);
       }
 
       smartlist_add(routerstatuses, vrs);





More information about the tor-commits mailing list