Changeset 12271


Ignore:
Timestamp:
Mar 31, 2011, 3:37:50 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) fix potential null pointer dereference in announcer.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer.c

    r12253 r12271  
    590590     * (note: this can leave gaps in the `tier' values, but since the calling
    591591     * function doesn't care, there's no point in removing the gaps...) */
    592     for( i=0, in=n; i<n; ++i )
    593         for( j=0, jn=n; j<n; ++j )
     592    for( i=0, in=n; i<in; ++i )
     593        for( j=0, jn=n; j<jn; ++j )
    594594            if( (i!=j) && (tmp[i].port==tmp[j].port)
    595595                       && !tr_strcmp0(tmp[i].host,tmp[j].host)
     
    609609
    610610    /* cleanup */
    611     for( i=0, in=n; i<n; ++i ) {
     611    for( i=0, in=n; i<in; ++i ) {
    612612        tr_free( tmp[i].path );
    613613        tr_free( tmp[i].host );
     
    10621062
    10631063            if(( tracker = tier->currentTracker ))
     1064            {
    10641065                tracker->consecutiveFailures = 0;
     1066                tracker->seederCount = response->seeders;
     1067                tracker->leecherCount = response->leechers;
     1068                tracker->downloadCount = response->downloads;
     1069
     1070                if(( str = response->tracker_id_str ))
     1071                {
     1072                    tr_free( tracker->tracker_id_str );
     1073                    tracker->tracker_id_str = tr_strdup( str );
     1074                }
     1075            }
    10651076
    10661077            if(( str = response->warning ))
     
    10771088            if(( i = response->interval ))
    10781089                tier->announceIntervalSec = i;
    1079 
    1080             if(( str = response->tracker_id_str ))
    1081             {
    1082                 tr_free( tier->currentTracker->tracker_id_str );
    1083                 tier->currentTracker->tracker_id_str = tr_strdup( str );
    1084             }
    1085 
    1086             tier->currentTracker->seederCount = response->seeders;
    1087             tier->currentTracker->leecherCount = response->leechers;
    1088             tier->currentTracker->downloadCount = response->downloads;
    10891090
    10901091            if( response->pex_count > 0 )
Note: See TracChangeset for help on using the changeset viewer.