]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'maint-0.3.2' into maint-0.3.3
authorNick Mathewson <nickm@torproject.org>
Fri, 21 Sep 2018 13:35:51 +0000 (09:35 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 21 Sep 2018 13:35:51 +0000 (09:35 -0400)
1  2 
src/or/protover.c
src/test/test_protover.c

index 5145881ba96880f10f6357612e97991adea6f738,ebaca07ba3229fe8297ba030094d5f1b6f4b0550..a63c2eb02d28cbcd38e56f17d68dd1ec943a76ec
@@@ -203,15 -206,10 +214,20 @@@ parse_single_entry(const char *s, cons
    if (equals == s)
      goto error;
  
 +  /* The name must not be longer than MAX_PROTOCOL_NAME_LENGTH. */
 +  if (equals - s > (int)MAX_PROTOCOL_NAME_LENGTH) {
 +    log_warn(LD_NET, "When parsing a protocol entry, I got a very large "
 +             "protocol name. This is possibly an attack or a bug, unless "
 +             "the Tor network truly supports protocol names larger than "
 +             "%ud characters. The offending string was: %s",
 +             MAX_PROTOCOL_NAME_LENGTH, escaped(out->name));
 +    goto error;
 +  }
++
+   /* The name must contain only alphanumeric characters and hyphens. */
+   if (!is_valid_keyword(s, equals-s))
+     goto error;
    out->name = tor_strndup(s, equals-s);
  
    tor_assert(equals < end_of_entry);
@@@ -919,5 -791,3 +935,4 @@@ protover_free_all(void
    }
  }
  
 +#endif /* !defined(HAVE_RUST) */
Simple merge