]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Enforce multiplicity rules when parsing annotations.
authorNick Mathewson <nickm@torproject.org>
Tue, 2 Nov 2010 15:49:58 +0000 (11:49 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 10 Nov 2010 21:02:02 +0000 (16:02 -0500)
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
src/or/routerparse.c

index d3cd7f343ef1d671c5ece2ec44b349dcdaac89eb..b259a306d2c9c30e2cc61d5b9558b30f64213cdf 100644 (file)
@@ -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.
 
index da08e466442280d49de55d2b5803b5c1fd922519..3d8ca143172ebbc63651bcb12fd076ccce9eb57e 100644 (file)
@@ -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) {