From 4d4f065e37fca873aa27a55a293ad0e13136d92e Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Sat, 1 Apr 2017 16:45:35 +0200 Subject: tools: oping: Fix bad calculation This fixes a potential overflow when calculating the packet loss. --- src/tools/oping/oping_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools') diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c index 77a08db7..43f402a2 100644 --- a/src/tools/oping/oping_client.c +++ b/src/tools/oping/oping_client.c @@ -234,7 +234,7 @@ int client_main(void) printf("%d SDUs transmitted, ", client.sent); printf("%d received, ", client.rcvd); printf("%d%% packet loss, ", client.sent == 0 ? 0 : - 100 - ((100 * client.rcvd) / client.sent)); + 100 - (100 * (client.rcvd / client.sent))); printf("time: %.3f ms\n", ts_diff_us(&tic, &toc) / 1000.0); if (client.rcvd > 0) { -- cgit v1.2.3