[or-cvs] [tor/release-0.2.2 098/162] Enforce multiplicity rules when parsing annotations.

arma at torproject.org arma at torproject.org
Mon Dec 20 03:06:38 UTC 2010


Author: Nick Mathewson <nickm at torproject.org>
Date: Tue, 2 Nov 2010 11:49:58 -0400
Subject: Enforce multiplicity rules when parsing annotations.
Commit: 2a50dd9359ec9bd113c64aa91cb5c2dd875de7dd

We would never actually enforce multiplicity rules when parsing
annotations, since the counts array never got entries added to it for
annotations in the token list that got added by earlier calls to
tokenize_string.

Found by piebeer.
---
 changes/annotations_fix |    4 +++-
 src/or/routerparse.c    |    3 +++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/changes/annotations_fix b/changes/annotations_fix
index d3cd7f3..b259a30 100644
--- a/changes/annotations_fix
+++ b/changes/annotations_fix
@@ -4,5 +4,7 @@
       Previously we would ignore such annotations at first, but cache
       them to disk anyway.  Bugfix on 0.2.0.8-alpha. Found by piebeer.
 
-
+  o Minor bugfixes
+    - Enforce multiplicity rules when parsing annotations.  Bugfix on
+      0.2.0.8-alpha. Found by piebeer.
 
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index da08e46..3d8ca14 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -3181,6 +3181,9 @@ tokenize_string(memarea_t *area,
     end = start+strlen(start);
   for (i = 0; i < _NIL; ++i)
     counts[i] = 0;
+
+  SMARTLIST_FOREACH(out, const directory_token_t *, t, ++counts[t->tp]);
+
   while (*s < end && (!tok || tok->tp != _EOF)) {
     tok = get_next_token(area, s, end, table);
     if (tok->tp == _ERR) {
-- 
1.7.1




More information about the tor-commits mailing list