1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 19:34:05 +00:00

(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.
This commit is contained in:
Jordan Lee 2011-05-05 03:10:51 +00:00
parent f8f02fe7c3
commit 45669fed08

View file

@ -370,14 +370,26 @@ geturllist( tr_info * inf,
inf->webseeds = tr_new0( char*, n ); inf->webseeds = tr_new0( char*, n );
for( i = 0; i < n; ++i ) for( i = 0; i < n; ++i )
{
if( tr_bencGetStr( tr_bencListChild( urls, i ), &url ) ) if( tr_bencGetStr( tr_bencListChild( urls, i ), &url ) )
inf->webseeds[inf->webseedCount++] = tr_strdup( url ); {
const size_t len = strlen( url );
if( tr_urlIsValid( url, len ) )
inf->webseeds[inf->webseedCount++] = tr_strndup( url, len );
}
}
} }
else if( tr_bencDictFindStr( meta, "url-list", &url ) ) /* handle single items in webseeds */ else if( tr_bencDictFindStr( meta, "url-list", &url ) ) /* handle single items in webseeds */
{ {
inf->webseedCount = 1; const size_t len = strlen( url );
inf->webseeds = tr_new0( char*, 1 );
inf->webseeds[0] = tr_strdup( url ); if( tr_urlIsValid( url, len ) )
{
inf->webseedCount = 1;
inf->webseeds = tr_new0( char*, 1 );
inf->webseeds[0] = tr_strndup( url, len );
}
} }
} }