summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordenis <>2007-05-04 23:08:38 +0000
committerdenis <>2007-05-04 23:08:38 +0000
commit8f0aaed6b2b3a91817a8e1ab34e3b1feee8a1519 (patch)
treef5395bb3d5c1e0a8031637d763d726e315b45de4
parent0f5a092f753b3173ba981ef492cd8187fdd6e962 (diff)
fixed an overflow in ot_overall_* variables
-rw-r--r--opentracker.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/opentracker.c b/opentracker.c
index af4db14..ecc2c9c 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -30,10 +30,10 @@
30#include "scan_urlencoded_query.h" 30#include "scan_urlencoded_query.h"
31 31
32/* Globals */ 32/* Globals */
33static unsigned int ot_overall_tcp_connections = 0; 33static unsigned long long ot_overall_tcp_connections = 0;
34static unsigned int ot_overall_udp_connections = 0; 34static unsigned long long ot_overall_udp_connections = 0;
35static unsigned int ot_overall_tcp_successfulannounces = 0; 35static unsigned long long ot_overall_tcp_successfulannounces = 0;
36static unsigned int ot_overall_udp_successfulannounces = 0; 36static unsigned long long ot_overall_udp_successfulannounces = 0;
37static time_t ot_start_time; 37static time_t ot_start_time;
38static const size_t SUCCESS_HTTP_HEADER_LENGTH = 80; 38static const size_t SUCCESS_HTTP_HEADER_LENGTH = 80;
39static const size_t SUCCESS_HTTP_SIZE_OFF = 17; 39static const size_t SUCCESS_HTTP_SIZE_OFF = 17;
@@ -285,14 +285,14 @@ static void httpresponse( const int64 s, char *data ) {
285 case STATS_UDP: 285 case STATS_UDP:
286 t = time( NULL ) - ot_start_time; 286 t = time( NULL ) - ot_start_time;
287 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, 287 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH,
288 "%i\n%i\n%i seconds (%i hours)\nopentracker udp4 stats.", 288 "%llu\n%llu\n%i seconds (%i hours)\nopentracker udp4 stats.",
289 ot_overall_udp_connections, ot_overall_udp_successfulannounces, (int)t, (int)(t / 3600) ); 289 ot_overall_udp_connections, ot_overall_udp_successfulannounces, (int)t, (int)(t / 3600) );
290 break; 290 break;
291 291
292 case STATS_TCP: 292 case STATS_TCP:
293 t = time( NULL ) - ot_start_time; 293 t = time( NULL ) - ot_start_time;
294 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, 294 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH,
295 "%i\n%i\n%i seconds (%i hours)\nopentracker tcp4 stats.", 295 "%llu\n%llu\n%i seconds (%i hours)\nopentracker tcp4 stats.",
296 ot_overall_tcp_connections, ot_overall_tcp_successfulannounces, (int)t, (int)(t / 3600) ); 296 ot_overall_tcp_connections, ot_overall_tcp_successfulannounces, (int)t, (int)(t / 3600) );
297 break; 297 break;
298 298
@@ -445,8 +445,8 @@ ANNOUNCE_WORKAROUND:
445 445
446 t = time( NULL ) - ot_start_time; 446 t = time( NULL ) - ot_start_time;
447 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, 447 reply_size = sprintf( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH,
448 "%i\n%i\n%i seconds (%i hours)\nopentracker - Pretuned by german engineers, currently handling %i connections per second.", 448 "%llu\n%llu\n%i seconds (%i hours)\nopentracker - Pretuned by german engineers, currently handling %llu connections per second.",
449 ot_overall_tcp_connections+ot_overall_udp_connections, ot_overall_tcp_successfulannounces+ot_overall_udp_successfulannounces, (int)t, (int)(t / 3600), (int)ot_overall_tcp_connections / ( (int)t ? (int)t : 1 ) ); 449 ot_overall_tcp_connections+ot_overall_udp_connections, ot_overall_tcp_successfulannounces+ot_overall_udp_successfulannounces, (int)t, (int)(t / 3600), ot_overall_tcp_connections / ( (unsigned int)t ? (unsigned int)t : 1 ) );
450 break; 450 break;
451 case 12: 451 case 12:
452 if( byte_diff( data, 12, "announce.php" ) ) HTTPERROR_404; 452 if( byte_diff( data, 12, "announce.php" ) ) HTTPERROR_404;