1
0
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:
Nick Hutchinson
2021-01-04 11:41:32 +00:00
parent b3d874d6a8
commit 1166094a2f

View File

@@ -154,6 +154,7 @@ vector<char> query_route_table(int family) {
throw exception_base("sysctl failed");
}
buf.resize(len);
return buf;
}