]> granicus.if.org Git - transmission/commitdiff
(trunk libT) fix ABR detected by clang static analyzer in tr_torrentStat.
authorJordan Lee <jordan@transmissionbt.com>
Thu, 31 Mar 2011 04:01:55 +0000 (04:01 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Thu, 31 Mar 2011 04:01:55 +0000 (04:01 +0000)
When copying a value to s->errorString, it used memcpy(a,b,sizeof(a)) where sizeof(a) was larger than sizeof(b). Fixed by replacing the memcpy() call with tr_strlcpy().

libtransmission/torrent.c

index 589aac1d98574d59ca0e0f9085f2dd61e8da0455..ebff3ff541b0b76a5690e98ee29cd80cbf685a7e 100644 (file)
@@ -1156,7 +1156,7 @@ tr_torrentStat( tr_torrent * tor )
     s->id = tor->uniqueId;
     s->activity = tr_torrentGetActivity( tor );
     s->error = tor->error;
-    memcpy( s->errorString, tor->errorString, sizeof( s->errorString ) );
+    tr_strlcpy( s->errorString, tor->errorString, sizeof( s->errorString ) );
 
     s->manualAnnounceTime = tr_announcerNextManualAnnounce( tor );