summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-11-02 11:49:58 -0400
committerNick Mathewson <nickm@torproject.org>2010-11-10 16:02:02 -0500
commit2a50dd9359ec9bd113c64aa91cb5c2dd875de7dd (patch)
treec62e04937fd5c71f54ecb5396192c72e729afc5e /src
parent089137f0112b0ad7c8ada8f2d5c7a967cfb87387 (diff)
downloadtor-2a50dd9359ec9bd113c64aa91cb5c2dd875de7dd.tar.gz
tor-2a50dd9359ec9bd113c64aa91cb5c2dd875de7dd.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/or/routerparse.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index da08e46644..3d8ca14317 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) {