aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-12-03 13:45:10 -0500
committerNick Mathewson <nickm@torproject.org>2010-12-03 13:45:10 -0500
commit0893793f0103467ffa0e0474013e4f6f88ecdc18 (patch)
treee6f4eaf4b90761f8297b4d2a7fcb5418585775b5
parent0bd884cd5b5e22283f7fa02a5ff4ef86ebd32095 (diff)
parentc0f1517d87d0c858ba8472eb85fd31df73f4b4d1 (diff)
downloadtor-0893793f0103467ffa0e0474013e4f6f88ecdc18.tar.gz
tor-0893793f0103467ffa0e0474013e4f6f88ecdc18.zip
Merge remote branch 'origin/maint-0.2.2'
-rw-r--r--changes/bug22353
-rw-r--r--src/or/hibernate.c21
2 files changed, 16 insertions, 8 deletions
diff --git a/changes/bug2235 b/changes/bug2235
new file mode 100644
index 0000000000..0c3bafa44f
--- /dev/null
+++ b/changes/bug2235
@@ -0,0 +1,3 @@
+ o Minor bugfixes
+ - Avoid crashes when AccountingMax is set on clients. Fixes bug 2235;
+ Bugfix on 0.2.2.18-alpha. Diagnosed by boboper.
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index e9be5930d1..356f9a0f55 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -529,14 +529,19 @@ accounting_set_wakeup_time(void)
}
}
- format_iso_time(buf, interval_start_time);
- crypto_pk_get_digest(get_server_identity_key(), digest);
-
- d_env = crypto_new_digest_env();
- crypto_digest_add_bytes(d_env, buf, ISO_TIME_LEN);
- crypto_digest_add_bytes(d_env, digest, DIGEST_LEN);
- crypto_digest_get_digest(d_env, digest, DIGEST_LEN);
- crypto_free_digest_env(d_env);
+ if (server_identity_key_is_set()) {
+ format_iso_time(buf, interval_start_time);
+
+ crypto_pk_get_digest(get_server_identity_key(), digest);
+
+ d_env = crypto_new_digest_env();
+ crypto_digest_add_bytes(d_env, buf, ISO_TIME_LEN);
+ crypto_digest_add_bytes(d_env, digest, DIGEST_LEN);
+ crypto_digest_get_digest(d_env, digest, DIGEST_LEN);
+ crypto_free_digest_env(d_env);
+ } else {
+ crypto_rand(digest, DIGEST_LEN);
+ }
if (!expected_bandwidth_usage) {
char buf1[ISO_TIME_LEN+1];