From c4f924810ee0aa390ccbcf306149512646875757 Mon Sep 17 00:00:00 2001 From: denis <> Date: Fri, 21 Sep 2007 22:24:22 +0000 Subject: fixed a small bug with 0 torrents and a cosmetical one --- trackerlogic.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'trackerlogic.c') diff --git a/trackerlogic.c b/trackerlogic.c index 4306822..0777c54 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -311,7 +311,8 @@ size_t return_fullscrape_for_tracker( char **reply ) { for( i=0; i<256; ++i ) torrent_count += all_torrents[i].size; - if( !( r = *reply = malloc( 128*torrent_count ) ) ) return 0; + // one extra for pro- and epilogue + if( !( r = *reply = malloc( 128*(1+torrent_count) ) ) ) return 0; memmove( r, "d5:filesd", 9 ); r += 9; for( i=0; i<256; ++i ) { @@ -687,7 +688,7 @@ size_t return_stats_for_slash24s( char *reply, size_t amount, ot_dword thresh ) for( i=0; i < amount; ++i ) if( slash24s[ 2*i ] >= thresh ) { unsigned long ip = slash24s[ 2*i +1 ]; - r += sprintf( r, "% 10ld %d.%d.%d/24\n", (long)slash24s[ 2*i ], (int)(ip >> 16), (int)(255 & ( ip >> 8 )), (int)(ip & 255) ); + r += sprintf( r, "% 10ld %d.%d.%d.0/24\n", (long)slash24s[ 2*i ], (int)(ip >> 16), (int)(255 & ( ip >> 8 )), (int)(ip & 255) ); } return r - reply; -- cgit v1.2.3