瀏覽代碼

Enforce multiplicity rules when parsing annotations.

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.
Nick Mathewson 14 年之前
父節點
當前提交
2a50dd9359
共有 2 個文件被更改,包括 6 次插入1 次删除
  1. 3 1
      changes/annotations_fix
  2. 3 0
      src/or/routerparse.c

+ 3 - 1
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.
 

+ 3 - 0
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) {