Skip to content

Commit

Permalink
Limit shifting in s24s cleanup code to a non-overflowing size
Browse files Browse the repository at this point in the history
  • Loading branch information
erdgeist committed Aug 30, 2009
1 parent 1c07656 commit 5f0b15a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ot_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static int stats_shift_down_network_count( stats_network_node **node, int depth,
depth += STATS_NETWORK_NODE_BITWIDTH;
if( depth == STATS_NETWORK_NODE_MAXDEPTH ) {
for( i=0; i<STATS_NETWORK_NODE_COUNT; ++i )
rest += ((*node)->counters[i]>>=shift);
rest += (*node)->counters[i] >>= shift;
return rest;
}

Expand Down Expand Up @@ -276,7 +276,7 @@ static size_t stats_slash24s_txt( char *reply, size_t amount ) {
bailout_error:
r = reply;
success:
stats_shift_down_network_count( &slash24s_network_counters_root, 0, STATS_NETWORK_NODE_MAXDEPTH*STATS_NETWORK_NODE_BITWIDTH );
stats_shift_down_network_count( &slash24s_network_counters_root, 0, sizeof(int)*8-1 );
if( slash24s_network_counters_root )
free( slash24s_network_counters_root );
return r-reply;
Expand Down Expand Up @@ -706,4 +706,4 @@ void stats_deinit( ) {
pthread_cancel( thread_id );
}

const char *g_version_stats_c = "$Source: /home/cvsroot/opentracker/ot_stats.c,v $: $Revision: 1.53 $\n";
const char *g_version_stats_c = "$Source: /home/cvsroot/opentracker/ot_stats.c,v $: $Revision: 1.54 $\n";

0 comments on commit 5f0b15a

Please sign in to comment.