diff --git a/libtransmission/crypto.h b/libtransmission/crypto.h index d8dd941b2..c36d67897 100644 --- a/libtransmission/crypto.h +++ b/libtransmission/crypto.h @@ -15,6 +15,8 @@ #include +#include /* TR_GNUC_NULL_TERMINATED */ + /** *** **/ @@ -73,7 +75,7 @@ void tr_cryptoEncrypt( tr_crypto * crypto, void tr_sha1( uint8_t * setme, const void * content1, int content1_len, - ... ); + ... ) TR_GNUC_NULL_TERMINATED; /** Returns a random number in the range of [0...n) */ diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c index 1b9efc823..ea5889e5d 100644 --- a/libtransmission/makemeta.c +++ b/libtransmission/makemeta.c @@ -215,8 +215,9 @@ getHashInfo( tr_metainfo_builder * b ) if( !fp ) { b->my_errno = errno; - tr_snprintf( b->errfile, sizeof( b->errfile ), - b->files[fileIndex].filename ); + tr_strlcpy( b->errfile, + b->files[fileIndex].filename, + sizeof( b->errfile ) ); b->result = TR_MAKEMETA_IO_READ; tr_free( buf ); tr_free( ret ); @@ -250,8 +251,9 @@ getHashInfo( tr_metainfo_builder * b ) if( !fp ) { b->my_errno = errno; - tr_snprintf( b->errfile, sizeof( b->errfile ), - b->files[fileIndex].filename ); + tr_strlcpy( b->errfile, + b->files[fileIndex].filename, + sizeof( b->errfile ) ); b->result = TR_MAKEMETA_IO_READ; tr_free( buf ); tr_free( ret ); diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 73007de55..7bd27d807 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -258,7 +258,7 @@ size_t tr_strlcpy( char * dst, int tr_snprintf( char * buf, size_t buflen, const char * fmt, - ... ); + ... ) TR_GNUC_PRINTF( 3, 4 ); const char* tr_strerror( int );