mfontanini / libtins

High-level, multiplatform C++ network packet sniffing and crafting library.
http://libtins.github.io/
BSD 2-Clause "Simplified" License
1.9k stars 375 forks source link

Fix infinite loop when querying BSD routing table #427

Closed nhutchinson-te closed 3 years ago

nhutchinson-te commented 3 years ago

Fix query_route_table() returning a buffer padded with extra '\0' bytes because it ignored the buffer size returned by sysctl().

This caused route_entries() / route6_entries() to fall into an infinite loop, forever trying to parse a 0-length routing entry.