diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-06-10 19:13:40 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-06-10 19:13:40 +0000 |
commit | 932f2c79eb8a7d5af62ca5f00fe6173392ffbaef (patch) | |
tree | bec25e71a4bf4f7afd8ca3aa6c053465d51c6433 | |
parent | 04995f197dcb34d829e27e91ad2e1b771ad6f835 (diff) | |
download | tor-932f2c79eb8a7d5af62ca5f00fe6173392ffbaef.tar.gz tor-932f2c79eb8a7d5af62ca5f00fe6173392ffbaef.zip |
r13338@catbus: nickm | 2007-06-10 15:13:32 -0400
Fix bug in 10533: put "opt v" line at the end of a routerstatus section; overwriting is bad.
svn:r10549
-rw-r--r-- | src/or/dirserv.c | 3 | ||||
-rw-r--r-- | src/or/test.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 2bc99e261a..974b80f502 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -1655,9 +1655,10 @@ routerstatus_format_entry(char *buf, size_t buf_len, log_warn(LD_BUG, "Not enough space in buffer."); return -1; } + cp += strlen(cp); if (version) { - if (tor_snprintf(buf, buf_len, "opt v %s\n", version)<0) { + if (tor_snprintf(cp, buf_len - (cp-buf), "opt v %s\n", version)<0) { log_warn(LD_BUG, "Unable to print router version."); return -1; } diff --git a/src/or/test.c b/src/or/test.c index ee432f3a4f..20ac1780b0 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -2126,6 +2126,11 @@ test_dir_format(void) } static void +test_v3_networkstatus(void) +{ +} + +static void test_policies(void) { addr_policy_t *policy, *policy2; @@ -2412,6 +2417,7 @@ main(int c, char**v) test_onion_handshake(); puts("\n========================= Directory Formats ==============="); test_dir_format(); + test_v3_networkstatus(); puts("\n========================= Policies ==================="); test_policies(); puts("\n========================= Rendezvous functionality ========"); |