aboutsummaryrefslogtreecommitdiff
path: root/src/rust/protover
diff options
context:
space:
mode:
authorcypherpunks <cypherpunks@torproject.org>2018-08-07 14:52:16 +0000
committercypherpunks <cypherpunks@torproject.org>2018-08-17 02:38:23 +0000
commite65a4fa42cdb3a2a0419e6178e1c141c98b28088 (patch)
treebcab465052fbcc459aa52a3afcad66203ced0625 /src/rust/protover
parent7bb658a63371df07f04054931606e6145a3816f6 (diff)
downloadtor-e65a4fa42cdb3a2a0419e6178e1c141c98b28088.tar.gz
tor-e65a4fa42cdb3a2a0419e6178e1c141c98b28088.zip
rust/protover: fix parsing docs
The function takes an already validated utf-8 string, and it never checks if the version numbers are an empty string. That parse error happens later. Fix on 701c2b69f52cb4db46aa7455904e518b35fafc1a
Diffstat (limited to 'src/rust/protover')
-rw-r--r--src/rust/protover/protover.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index ad1fd446e9..f8e64c822c 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -452,8 +452,9 @@ impl UnvalidatedProtoEntry {
/// following are true:
///
/// * If a protocol name is an empty string, e.g. `"Cons=1,3 =3-5"`.
- /// * If a protocol name cannot be parsed as utf-8.
- /// * If the version numbers are an empty string, e.g. `"Cons="`.
+ /// * If an entry has no equals sign, e.g. `"Cons=1,3 Desc"`.
+ /// * If there is leading or trailing whitespace, e.g. `" Cons=1,3 Link=3"`.
+ /// * If there is any other extra whitespice, e.g. `"Cons=1,3 Link=3"`.
fn parse_protocol_and_version_str<'a>(
protocol_string: &'a str,
) -> Result<Vec<(&'a str, &'a str)>, ProtoverError> {