summaryrefslogtreecommitdiff
path: root/src/or/dirserv.c
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2009-08-11 17:33:58 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2009-08-11 17:33:58 +0200
commita98643c1b5a39764204fcf6835a8b2bee670581d (patch)
treeab7d6c0eba944f34c7fee0f105e4f6394acaa042 /src/or/dirserv.c
parente50b7768b94bbcccef77be255920e3aac80a9555 (diff)
downloadtor-a98643c1b5a39764204fcf6835a8b2bee670581d.tar.gz
tor-a98643c1b5a39764204fcf6835a8b2bee670581d.zip
Fix possible segmentation fault on directory authorities.
The more verbose logs that were added in ee58153 also include a string that might not have been initialized. This can lead to segfaults, e.g., when setting up private Tor networks. Initialize this string with NULL.
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r--src/or/dirserv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index a64a01bb80..349e383ab5 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -652,8 +652,8 @@ dirserv_add_multiple_descriptors(const char *desc, uint8_t purpose,
/** Examine the parsed server descriptor in <b>ri</b> and maybe insert it into
* the list of server descriptors. Set *<b>msg</b> to a message that should be
- * passed back to the origin of this descriptor. Use <b>source</b> to produce
- * better log messages.
+ * passed back to the origin of this descriptor, or NULL if there is no such
+ * message. Use <b>source</b> to produce better log messages.
*
* Return the status of the operation
*
@@ -667,6 +667,7 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
routerinfo_t *ri_old;
char *desc, *nickname;
size_t desclen = 0;
+ *msg = NULL;
/* If it's too big, refuse it now. Otherwise we'll cache it all over the
* network and it'll clog everything up. */
@@ -718,7 +719,7 @@ dirserv_add_descriptor(routerinfo_t *ri, const char **msg, const char *source)
control_event_or_authdir_new_descriptor("REJECTED", desc, desclen, *msg);
log_info(LD_DIRSERV,
"Did not add descriptor from '%s' (source: %s): %s.",
- nickname, source, *msg);
+ nickname, source, *msg ? *msg : "(no message)");
} else {
smartlist_t *changed;
control_event_or_authdir_new_descriptor("ACCEPTED", desc, desclen, *msg);