mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
Merge branch 'maint-0.3.3' into maint-0.3.4
This commit is contained in:
commit
ac721bd3b4
4
changes/bug27164
Normal file
4
changes/bug27164
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
o Minor bugfixes (rust):
|
||||||
|
- Protover parsing was ignoring a 2nd hyphen and everything after it,
|
||||||
|
accepting entries like "Link=1-5-foo". Fixes bug 27164; bugfix on
|
||||||
|
0.3.3.1-alpha.
|
@ -348,7 +348,7 @@ impl FromStr for ProtoSet {
|
|||||||
if p.is_empty() {
|
if p.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
} else if p.contains('-') {
|
} else if p.contains('-') {
|
||||||
let mut pair = p.split('-');
|
let mut pair = p.splitn(2, '-');
|
||||||
|
|
||||||
let low = pair.next().ok_or(ProtoverError::Unparseable)?;
|
let low = pair.next().ok_or(ProtoverError::Unparseable)?;
|
||||||
let high = pair.next().ok_or(ProtoverError::Unparseable)?;
|
let high = pair.next().ok_or(ProtoverError::Unparseable)?;
|
||||||
@ -538,6 +538,18 @@ mod test {
|
|||||||
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("-1"));
|
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("-1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_versions_from_str_hyphens() {
|
||||||
|
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("--1"));
|
||||||
|
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("-1-2"));
|
||||||
|
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1--2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_versions_from_str_triple() {
|
||||||
|
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1-2-3"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_versions_from_str_1exclam() {
|
fn test_versions_from_str_1exclam() {
|
||||||
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1,!"));
|
assert_eq!(Err(ProtoverError::Unparseable), ProtoSet::from_str("1,!"));
|
||||||
|
Loading…
Reference in New Issue
Block a user