diff options
| author | Nick Hutchinson <nhutchinson@thousandeyes.com> | 2021-01-04 11:41:32 +0000 |
|---|---|---|
| committer | Nick Hutchinson <nhutchinson@thousandeyes.com> | 2021-01-04 12:02:03 +0000 |
| commit | 1166094a2f0e34ed5308f8729cbd7a637e64e5b1 (patch) | |
| tree | b747b9b8bb6cee2ed7cf708d9bc2af59766b27d3 | |
| parent | b3d874d6a86e29735818518e8d0d5cf4cc381a82 (diff) | |
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.
| -rw-r--r-- | src/utils/routing_utils.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/utils/routing_utils.cpp b/src/utils/routing_utils.cpp index d107de8..191803e 100644 --- a/src/utils/routing_utils.cpp +++ b/src/utils/routing_utils.cpp @@ -154,6 +154,7 @@ vector<char> query_route_table(int family) { throw exception_base("sysctl failed"); } + buf.resize(len); return buf; } |
