summaryrefslogtreecommitdiff
path: root/trackerlogic.c
diff options
context:
space:
mode:
authordenis <>2007-09-21 22:24:22 +0000
committerdenis <>2007-09-21 22:24:22 +0000
commitc4f924810ee0aa390ccbcf306149512646875757 (patch)
tree414d4f8a91364730a05e1e4fbc27d144ced98960 /trackerlogic.c
parent6ad00cadc56e8ee2f892060abf2307cb66c0e2f6 (diff)
fixed a small bug with 0 torrents and a cosmetical one
Diffstat (limited to 'trackerlogic.c')
-rw-r--r--trackerlogic.c5
1 files changed, 3 insertions, 2 deletions
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 ) {
311 for( i=0; i<256; ++i ) 311 for( i=0; i<256; ++i )
312 torrent_count += all_torrents[i].size; 312 torrent_count += all_torrents[i].size;
313 313
314 if( !( r = *reply = malloc( 128*torrent_count ) ) ) return 0; 314 // one extra for pro- and epilogue
315 if( !( r = *reply = malloc( 128*(1+torrent_count) ) ) ) return 0;
315 316
316 memmove( r, "d5:filesd", 9 ); r += 9; 317 memmove( r, "d5:filesd", 9 ); r += 9;
317 for( i=0; i<256; ++i ) { 318 for( i=0; i<256; ++i ) {
@@ -687,7 +688,7 @@ size_t return_stats_for_slash24s( char *reply, size_t amount, ot_dword thresh )
687 for( i=0; i < amount; ++i ) 688 for( i=0; i < amount; ++i )
688 if( slash24s[ 2*i ] >= thresh ) { 689 if( slash24s[ 2*i ] >= thresh ) {
689 unsigned long ip = slash24s[ 2*i +1 ]; 690 unsigned long ip = slash24s[ 2*i +1 ];
690 r += sprintf( r, "% 10ld %d.%d.%d/24\n", (long)slash24s[ 2*i ], (int)(ip >> 16), (int)(255 & ( ip >> 8 )), (int)(ip & 255) ); 691 r += sprintf( r, "% 10ld %d.%d.%d.0/24\n", (long)slash24s[ 2*i ], (int)(ip >> 16), (int)(255 & ( ip >> 8 )), (int)(ip & 255) );
691 } 692 }
692 693
693 return r - reply; 694 return r - reply;