Changeset 12416


Ignore:
Timestamp:
May 5, 2011, 3:10:51 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) #4227 "invalid URLs aren't filtered out of .torrents' webseed lists"

If we can't parse a URL provided in the .torrent files' webseed list, that URL should be discarded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/metainfo.c

    r12293 r12416  
    371371
    372372        for( i = 0; i < n; ++i )
     373        {
    373374            if( tr_bencGetStr( tr_bencListChild( urls, i ), &url ) )
    374                 inf->webseeds[inf->webseedCount++] = tr_strdup( url );
     375            {
     376                const size_t len = strlen( url );
     377
     378                if( tr_urlIsValid( url, len  ) )
     379                    inf->webseeds[inf->webseedCount++] = tr_strndup( url, len );
     380            }
     381        }
    375382    }
    376383    else if( tr_bencDictFindStr( meta, "url-list", &url ) ) /* handle single items in webseeds */
    377384    {
    378         inf->webseedCount = 1;
    379         inf->webseeds = tr_new0( char*, 1 );
    380         inf->webseeds[0] = tr_strdup( url );
     385        const size_t len = strlen( url );
     386
     387        if( tr_urlIsValid( url, len  ) )
     388        {
     389            inf->webseedCount = 1;
     390            inf->webseeds = tr_new0( char*, 1 );
     391            inf->webseeds[0] = tr_strndup( url, len );
     392        }
    381393    }
    382394}
Note: See TracChangeset for help on using the changeset viewer.