Replaced strcpy() with strncpy() in tests suites

This commit is contained in:
Paul Bakker 2014-04-17 16:06:37 +02:00
parent b6487dade9
commit dd0aae92e0
3 changed files with 16 additions and 18 deletions

View file

@ -16,7 +16,7 @@ void md2_text( char *text_src_string, char *hex_hash_string )
memset( hash_str, 0x00, sizeof hash_str );
memset( output, 0x00, sizeof output );
strcpy( (char *) src_str, text_src_string );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
md2( src_str, strlen( (char *) src_str ), output );
hexify( hash_str, output, sizeof output );
@ -36,7 +36,7 @@ void md4_text( char *text_src_string, char *hex_hash_string )
memset( hash_str, 0x00, sizeof hash_str );
memset( output, 0x00, sizeof output );
strcpy( (char *) src_str, text_src_string );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
md4( src_str, strlen( (char *) src_str ), output );
hexify( hash_str, output, sizeof output );
@ -56,7 +56,7 @@ void md5_text( char *text_src_string, char *hex_hash_string )
memset( hash_str, 0x00, sizeof hash_str );
memset( output, 0x00, sizeof output );
strcpy( (char *) src_str, text_src_string );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
md5( src_str, strlen( (char *) src_str ), output );
hexify( hash_str, output, sizeof output );
@ -76,7 +76,7 @@ void ripemd160_text( char *text_src_string, char *hex_hash_string )
memset(hash_str, 0x00, sizeof hash_str);
memset(output, 0x00, sizeof output);
strcpy( (char *) src_str, text_src_string );
strncpy( (char *) src_str, text_src_string, sizeof(src_str) - 1 );
ripemd160( src_str, strlen( (char *) src_str ), output );
hexify( hash_str, output, sizeof output );