diff --git a/Jamfile b/Jamfile index 2ad11bb..f87995b 100644 --- a/Jamfile +++ b/Jamfile @@ -18,11 +18,10 @@ exe dht-bootstrap multi src boost-system - gcc:-std=c++11 - darwin:-std=c++11 : # default build static multi + 14 : # usage requirements ; @@ -35,11 +34,10 @@ exe dht-torture multi src boost-system - gcc:-std=c++11 - darwin:-std=c++11 : # default build static multi + 14 : # usage requirements ; diff --git a/src/main.cpp b/src/main.cpp index 225032d..d86e708 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -177,11 +177,12 @@ void print_stats(steady_timer& stats_timer, error_code const& ec) } client_histogram.clear(); } - std::sort(ordered.begin(), ordered.end()); - char client_dist[200]; + std::sort(ordered.begin(), ordered.end(), std::greater<>{}); + char client_dist[250]; client_dist[0] = '\0'; int len = 0; for (auto i : ordered) { + if (len > sizeof(client_dist) - 10) break; len += snprintf(client_dist + len, sizeof(client_dist) - len , "[%c%c: %d] ", (i.second >> 8) & 0xff, i.second & 0xff, i.first); }