aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2022-07-27 09:16:50 -0400
committerNick Mathewson <nickm@torproject.org>2022-07-27 09:16:50 -0400
commit8e7bd9636260af3e31997e2ad5ec071c4e7a0153 (patch)
tree115936c17eeb302d07dccabc1aecd2ed7c2475c6 /src
parent8d8afc4efa538682ef2b80f6664456b34b84e519 (diff)
downloadtor-8e7bd9636260af3e31997e2ad5ec071c4e7a0153.tar.gz
tor-8e7bd9636260af3e31997e2ad5ec071c4e7a0153.zip
Fix a check, make a netflow padding function more safe.
Previously, `channelpadding_get_netflow_inactive_timeout_ms` would crash with an assertion failure if `low_timeout` was greater than `high_timeout`. That wasn't possible in practice because of checks in `channelpadding_update_padding_for_channel`, but it's better not to have a function whose correctness is this tricky to prove. Fixes #40645. Bugfix on 0.3.1.1-alpha.
Diffstat (limited to 'src')
-rw-r--r--src/core/or/channelpadding.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/or/channelpadding.c b/src/core/or/channelpadding.c
index d0c43e8bdc..d4c19491ac 100644
--- a/src/core/or/channelpadding.c
+++ b/src/core/or/channelpadding.c
@@ -186,7 +186,7 @@ channelpadding_get_netflow_inactive_timeout_ms(const channel_t *chan)
high_timeout = MAX(high_timeout, chan->padding_timeout_high_ms);
}
- if (low_timeout == high_timeout)
+ if (low_timeout >= high_timeout)
return low_timeout; // No randomization
/*