diff options
author | Danil Zagoskin <[email protected]> | 2014-05-10 13:23:06 +0400 |
---|---|---|
committer | Danil Zagoskin <[email protected]> | 2014-05-10 13:23:06 +0400 |
commit | 4c34c06adc8709a6c13e2b5419e66582244040e6 (patch) | |
tree | 369b44b88c9cb829a577aadb43f5dd8c2b10784a | |
parent | aca0b6182b039333b4c963938878d9eecc85e5a1 (diff) | |
download | otp-4c34c06adc8709a6c13e2b5419e66582244040e6.tar.gz otp-4c34c06adc8709a6c13e2b5419e66582244040e6.tar.bz2 otp-4c34c06adc8709a6c13e2b5419e66582244040e6.zip |
ssl: fix max sequence number so it does not overflow
The old value of 18446744073709552000 was calculated using math:pow
which returns float therefore isn't precise. And it would overflow:
erlang:integer_to_list(18446744073709552000, 16) = "10000000000000180"
This patch changes MAX_SEQENCE_NUMBER to value calculated with bitwise
shift:
(1 bsl 64) - 1 = 18446744073709551615
-rw-r--r-- | lib/ssl/src/ssl_record.hrl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ssl/src/ssl_record.hrl b/lib/ssl/src/ssl_record.hrl index 87ed233c0a..6aab35d6da 100644 --- a/lib/ssl/src/ssl_record.hrl +++ b/lib/ssl/src/ssl_record.hrl @@ -70,7 +70,7 @@ -define(INITIAL_BYTES, 5). --define(MAX_SEQENCE_NUMBER, 18446744073709552000). %% math:pow(2, 64) - 1 = 1.8446744073709552e19 +-define(MAX_SEQENCE_NUMBER, 18446744073709551615). %% (1 bsl 64) - 1 = 18446744073709551615 %% Sequence numbers can not wrap so when max is about to be reached we should renegotiate. %% We will renegotiate a little before so that there will be sequence numbers left %% for the rehandshake and a little data. Currently we decided to renegotiate a little more |