Skip to content

Commit

Permalink
fix TCP Timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
imguoliwei committed Apr 26, 2022
1 parent 4f7728c commit d90ebf8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ua2f-mix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class TcpOptionsScanner {
[[nodiscard]] bool hasNext() const { return curr < bound; }

void next(){
if(!hasNext()) throw std::out_of_range("TcpOptionsScanner out of bound");
using std::out_of_range;
if(!hasNext()) throw out_of_range("TcpOptionsScanner out of bound");
if(*curr == TCPOPT_EOL) throw out_of_range("TcpOptionsScanner's pointer reach end of option list");
if(*curr == TCPOPT_NOP){
++curr;
} else {
Expand Down Expand Up @@ -217,6 +219,7 @@ static bool clearTcpTimestamps(pkt_buff *const pktb, const variant<iphdr*, ip6_h
if(tcpPkHdl->doff * 4 == sizeof(tcphdr)) return false;
for(TcpOptionsScanner optScanner(tcpPkHdl); optScanner.hasNext(); optScanner.next()){
auto const curr = optScanner.getCurrOption();
if(*curr == TCPOPT_EOL) return false;
if(*curr != TCPOPT_TIMESTAMP) continue;
const unsigned int dataOffset = reinterpret_cast<const char*>(tcpPkHdl) - (
isIPv4 ?
Expand Down

0 comments on commit d90ebf8

Please sign in to comment.