mirror of
https://github.com/mfontanini/libtins
synced 2026-01-24 19:21:35 +01:00
Fix infinite loop when querying BSD routing table
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.
This commit is contained in:
@@ -154,6 +154,7 @@ vector<char> query_route_table(int family) {
|
||||
throw exception_base("sysctl failed");
|
||||
}
|
||||
|
||||
buf.resize(len);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user