From 9e87e5cabfbdd968ba0d2e8ccfc35f876df58d61 Mon Sep 17 00:00:00 2001 From: Ruediger Pluem Date: Sat, 2 Feb 2008 20:36:18 +0000 Subject: [PATCH] * Use a 64 bit unsigned int instead of a signed long to count the bytes transferred to avoid integer overflows. PR: 44346 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@617890 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ support/ab.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index bc28dce7ca..590029ac8e 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) ab: Use a 64 bit unsigned int instead of a signed long to count the + bytes transferred to avoid integer overflows. PR 44346 [Ruediger Pluem] + *) mod_proxy_ajp: Do not retry request in the case that we either failed to sent a part of the request body or if the request is not idempotent. PR 44334 [Ruediger Pluem] diff --git a/support/ab.c b/support/ab.c index 46040af0d4..37ddbd9d6f 100644 --- a/support/ab.c +++ b/support/ab.c @@ -306,9 +306,9 @@ const char *tdstring; apr_size_t doclen = 0; /* the length the document should be */ long started = 0; /* number of requests started, so no excess */ -long totalread = 0; /* total number of bytes read */ -long totalbread = 0; /* totoal amount of entity body read */ -long totalposted = 0; /* total number of bytes posted, inc. headers */ +apr_uint64_t totalread = 0; /* total number of bytes read */ +apr_uint64_t totalbread = 0; /* totoal amount of entity body read */ +apr_uint64_t totalposted = 0; /* total number of bytes posted, inc. headers */ long done = 0; /* number of requests we have done */ long doneka = 0; /* number of keep alive connections done */ long good = 0, bad = 0; /* number of good and bad requests */ @@ -773,10 +773,10 @@ static void output_results(int sig) printf("Non-2xx responses: %d\n", err_response); if (keepalive) printf("Keep-Alive requests: %ld\n", doneka); - printf("Total transferred: %ld bytes\n", totalread); + printf("Total transferred: %" APR_UINT64_T_FMT " bytes\n", totalread); if (posting > 0) - printf("Total POSTed: %ld\n", totalposted); - printf("HTML transferred: %ld bytes\n", totalbread); + printf("Total POSTed: %" APR_UINT64_T_FMT "\n", totalposted); + printf("HTML transferred: %" APR_UINT64_T_FMT " bytes\n", totalbread); /* avoid divide by zero */ if (timetaken) { @@ -1045,14 +1045,14 @@ static void output_html_results(void) "%ld\n", trstring, tdstring, tdstring, doneka); printf("Total transferred:" - "%ld bytes\n", + "%" APR_UINT64_T_FMT " bytes\n", trstring, tdstring, tdstring, totalread); if (posting > 0) printf("Total POSTed:" - "%ld\n", + "%" APR_UINT64_T_FMT "\n", trstring, tdstring, tdstring, totalposted); printf("HTML transferred:" - "%ld bytes\n", + "%" APR_UINT64_T_FMT " bytes\n", trstring, tdstring, tdstring, totalbread); /* avoid divide by zero */ -- 2.40.0