]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
r13338@catbus: nickm | 2007-06-10 15:13:32 -0400
authorNick Mathewson <nickm@torproject.org>
Sun, 10 Jun 2007 19:13:40 +0000 (19:13 +0000)
committerNick Mathewson <nickm@torproject.org>
Sun, 10 Jun 2007 19:13:40 +0000 (19:13 +0000)
 Fix bug in 10533: put "opt v" line at the end of a routerstatus section; overwriting is bad.

svn:r10549

src/or/dirserv.c
src/or/test.c

index 2bc99e261aeb68af7cb7a0d47113edb4c363f982..974b80f502fd4663e43c52b5d86c57606266a745 100644 (file)
@@ -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;
     }
index ee432f3a4f48993695cfb47c83e8f256ffd84885..20ac1780b0d9146890fce2f71db30a2dee581984 100644 (file)
@@ -2125,6 +2125,11 @@ test_dir_format(void)
                                    "Tor 0.2.1.0-dev (r99)"));
 }
 
+static void
+test_v3_networkstatus(void)
+{
+}
+
 static void
 test_policies(void)
 {
@@ -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 ========");