]> granicus.if.org Git - transmission/commitdiff
(trunk libT) #4504 "crash when adding malformed magnet link" -- fixed.
authorJordan Lee <jordan@transmissionbt.com>
Sun, 25 Sep 2011 21:51:50 +0000 (21:51 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sun, 25 Sep 2011 21:51:50 +0000 (21:51 +0000)
libtransmission/magnet.c

index 5bab49b60fe285dba33c18405e5bb4d369da5f3e..e3c4bd6cb49def5c077a26b3ffae8146aa5154e5 100644 (file)
@@ -149,10 +149,10 @@ tr_magnetParse( const char * uri )
                 }
             }
 
-            if( ( keylen==2 ) && !memcmp( key, "dn", 2 ) )
+            if( ( vallen > 0 ) && ( keylen==2 ) && !memcmp( key, "dn", 2 ) )
                 displayName = tr_http_unescape( val, vallen );
 
-            if( trCount < MAX_TRACKERS ) {
+            if( ( vallen > 0 ) && ( trCount < MAX_TRACKERS ) ) {
                 int i;
                 if( ( keylen==2 ) && !memcmp( key, "tr", 2 ) )
                     tr[trCount++] = tr_http_unescape( val, vallen );