Skip to content

Fix ttl overflow#42

Open
therealvinayak wants to merge 2 commits into
routing_engine_improvementsfrom
fix-ttl-overflow
Open

Fix ttl overflow#42
therealvinayak wants to merge 2 commits into
routing_engine_improvementsfrom
fix-ttl-overflow

Conversation

@therealvinayak
Copy link
Copy Markdown
Collaborator

Fix TTL overflow in routing_engine.cpp

The previous implementation used:

hdr.timestamp + hdr.lifetime_s < now

This can overflow when timestamp is near the uint32_t wrap boundary,
leading to incorrect packet acceptance or drops.

This patch replaces it with wrap-safe unsigned subtraction:

elapsed = now - hdr.timestamp

which correctly handles timer wrap-around.

Fixes #32

@taruntom1 taruntom1 changed the base branch from main to routing_engine_improvements March 14, 2026 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TTL check is vulnerable to 32-bit timestamp wrap arithmetic

1 participant