From: Jordan Lee Date: Thu, 31 Mar 2011 04:01:55 +0000 (+0000) Subject: (trunk libT) fix ABR detected by clang static analyzer in tr_torrentStat. X-Git-Tag: 2.30b1~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb561b54941a184c9cd54fe4115933a9df0052c0;p=transmission (trunk libT) fix ABR detected by clang static analyzer in tr_torrentStat. 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(). --- diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index 589aac1d9..ebff3ff54 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -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 );