Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/rsyncrypto-1.14/process.cpp Examining data/rsyncrypto-1.14/rsyncrypto.h Examining data/rsyncrypto-1.14/process.h Examining data/rsyncrypto-1.14/file.cpp Examining data/rsyncrypto-1.14/aes_crypt.cpp Examining data/rsyncrypto-1.14/redir.h Examining data/rsyncrypto-1.14/redir.cpp Examining data/rsyncrypto-1.14/filemap.h Examining data/rsyncrypto-1.14/blocksizes.cpp Examining data/rsyncrypto-1.14/crypto.cpp Examining data/rsyncrypto-1.14/file.h Examining data/rsyncrypto-1.14/bufferfd.cpp Examining data/rsyncrypto-1.14/crypto.h Examining data/rsyncrypto-1.14/rcserror.h Examining data/rsyncrypto-1.14/aes_crypt.h Examining data/rsyncrypto-1.14/autommap.h Examining data/rsyncrypto-1.14/filemap.cpp Examining data/rsyncrypto-1.14/win32/process.cpp Examining data/rsyncrypto-1.14/win32/process.h Examining data/rsyncrypto-1.14/win32/autofd.cpp Examining data/rsyncrypto-1.14/win32/redir.cpp Examining data/rsyncrypto-1.14/win32/config.h Examining data/rsyncrypto-1.14/win32/autohandle.h Examining data/rsyncrypto-1.14/win32/win32redir.h Examining data/rsyncrypto-1.14/win32/types.h Examining data/rsyncrypto-1.14/win32/nullgzip.cpp Examining data/rsyncrypto-1.14/win32/stdafx.cpp Examining data/rsyncrypto-1.14/win32/resource.h Examining data/rsyncrypto-1.14/win32/autommap.h Examining data/rsyncrypto-1.14/win32/autopipe.h Examining data/rsyncrypto-1.14/win32/autofd.h Examining data/rsyncrypto-1.14/win32/win32glue.cpp Examining data/rsyncrypto-1.14/win32/autodir.h Examining data/rsyncrypto-1.14/bufferfd.h Examining data/rsyncrypto-1.14/recover.cpp Examining data/rsyncrypto-1.14/main.cpp Examining data/rsyncrypto-1.14/autopipe.h Examining data/rsyncrypto-1.14/crypt_key.cpp Examining data/rsyncrypto-1.14/precomp.h Examining data/rsyncrypto-1.14/random.h Examining data/rsyncrypto-1.14/autoarray.h Examining data/rsyncrypto-1.14/autodir.h Examining data/rsyncrypto-1.14/crypt_key.h Examining data/rsyncrypto-1.14/autofd.h FINAL RESULTS: data/rsyncrypto-1.14/process.cpp:63:9: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(cmd, arguments.get() ); data/rsyncrypto-1.14/recover.cpp:46:10: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. char crypt[32]; data/rsyncrypto-1.14/recover.cpp:87:28: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. record.crypt[line_state]=ch; data/rsyncrypto-1.14/recover.cpp:112:70: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. std::cout<<record.dirsep<<std::string(record.crypt,32)<<" "<<record.plain<<'\0'; data/rsyncrypto-1.14/recover.cpp:115:102: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. std::cerr<<"Offset "<<offset<<": Plain name for cipher "<<std::string(record.crypt,32)<<" is empty"<<std::endl; data/rsyncrypto-1.14/win32/autofd.cpp:121:39: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. newfile=CreateFileA(pathname, access, data/rsyncrypto-1.14/win32/autofd.cpp:126:50: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. newfile=CreateFileW(a2u(pathname).get(), access, data/rsyncrypto-1.14/autodir.h:55:24: [3] (buffer) getwd: This does not protect against buffer overflows by itself, so use with caution (CWE-120, CWE-20). Use getcwd instead. static std::string getwd() data/rsyncrypto-1.14/blocksizes.cpp:66:9: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. random::rand( &buff, 1 ); data/rsyncrypto-1.14/random.h:4:7: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. class random { data/rsyncrypto-1.14/win32/process.cpp:82:9: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. if( CreateProcess(NULL, data/rsyncrypto-1.14/win32/process.cpp:82:9: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. if( CreateProcess(NULL, data/rsyncrypto-1.14/aes_crypt.cpp:41:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( secret_key.get(), import->key, key_size ); data/rsyncrypto-1.14/aes_crypt.cpp:61:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( secret_key.get(), that.secret_key.get(), header.key_size ); data/rsyncrypto-1.14/aes_crypt.cpp:71:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( buff+length, aes_header.iv, sizeof( aes_header.iv ) ); data/rsyncrypto-1.14/aes_crypt.cpp:74:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( buff+length, secret_key.get(), header.key_size ); data/rsyncrypto-1.14/aes_crypt.h:9:18: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char iv[AES_BLOCK_SIZE]; data/rsyncrypto-1.14/aes_crypt.h:10:18: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char key[1]; data/rsyncrypto-1.14/aes_crypt.h:15:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char cbc_base[AES_BLOCK_SIZE]; data/rsyncrypto-1.14/autofd.h:60:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd=open( pathname, flags, mode ); data/rsyncrypto-1.14/autofd.h:179:30: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static int utimes( const char *filename, const struct timeval tv[2]) data/rsyncrypto-1.14/bufferfd.cpp:45:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( buf, buffer.get()+startpos, copysize ); data/rsyncrypto-1.14/bufferfd.cpp:83:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( buffer.get()+buffill, buf, fill ); data/rsyncrypto-1.14/bufferfd.cpp:89:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( buffer.get(), static_cast<const char *>(buf)+fill, count ); data/rsyncrypto-1.14/process.cpp:56:42: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. auto_array<char *> arguments(new char *[numargs+2]); data/rsyncrypto-1.14/recover.cpp:46:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char crypt[32]; data/rsyncrypto-1.14/rsyncrypto.h:109:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[500]; data/rsyncrypto-1.14/win32/autodir.h:11:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char d_name[MAX_PATH]; data/rsyncrypto-1.14/win32/autofd.cpp:10:16: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). int newlen=MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, NULL, 0 ); data/rsyncrypto-1.14/win32/autofd.cpp:18:9: [2] (buffer) MultiByteToWideChar: Requires maximum length in CHARACTERS, not bytes (CWE-120). if( MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, str, -1, buffer.get(), newlen )==0 ) { data/rsyncrypto-1.14/win32/autofd.cpp:254:27: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. int autofd::utimes( const char *filename, const struct timeval tv[2], bool utf8) data/rsyncrypto-1.14/win32/autofd.h:100:30: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static int utimes( const char *filename, const struct timeval tv[2], bool utf8=false); data/rsyncrypto-1.14/win32/nullgzip.cpp:6:14: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char buffer[8192]; data/rsyncrypto-1.14/autodir.h:38:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). struct dirent *read() data/rsyncrypto-1.14/autofd.h:107:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static ssize_t read( file_t fd, void *buf, size_t count ) data/rsyncrypto-1.14/autofd.h:109:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t res=::read( fd, buf, count ); data/rsyncrypto-1.14/autofd.h:117:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read( void *buf, size_t count ) const data/rsyncrypto-1.14/autofd.h:119:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t num=read( fd, buf, count ); data/rsyncrypto-1.14/autofd.h:202:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( read( &ch, 1 )==1 && ch!='\n' ) { data/rsyncrypto-1.14/bufferfd.cpp:52:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read_bufferfd::read( void *buf, size_t count ) const data/rsyncrypto-1.14/bufferfd.cpp:60:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t numread=autofd::read( buffer.get(), buf_size ); data/rsyncrypto-1.14/bufferfd.h:34:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read( void *buf, size_t count ) const; data/rsyncrypto-1.14/crypto.cpp:199:29: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( (numread=readfd->read(buffer.get()+i, 1))!=0 ) { data/rsyncrypto-1.14/crypto.cpp:278:37: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( !done && (numread=fromfd.read( buffer.get(), block_size))!=0 ) { data/rsyncrypto-1.14/crypto.cpp:313:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if( fromfd.read( buffer2.get(), block_size)!=static_cast<ssize_t>(block_size) ) data/rsyncrypto-1.14/file.cpp:179:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( (ent=dir.read())!=NULL ) { data/rsyncrypto-1.14/win32/autodir.h:43:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). struct dirent *read(); data/rsyncrypto-1.14/win32/autofd.cpp:136:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t autofd::read( file_t fd, void *buf, size_t count ) data/rsyncrypto-1.14/win32/autofd.cpp:145:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t autofd::read( void *buf, size_t count ) const data/rsyncrypto-1.14/win32/autofd.cpp:147:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t num=read( *static_cast<const autohandle *>(this), buf, count ); data/rsyncrypto-1.14/win32/autofd.cpp:390:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while( read( &ch, 1 )==1 && ch!='\n' ) { data/rsyncrypto-1.14/win32/autofd.cpp:426:25: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). struct dirent *autodir::read() data/rsyncrypto-1.14/win32/autofd.cpp:468:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( finddata.cFileName, u2a(data->cFileName).get(), MAX_PATH ); data/rsyncrypto-1.14/win32/autofd.h:76:20: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). static ssize_t read( file_t fd, void *buf, size_t count ); data/rsyncrypto-1.14/win32/autofd.h:78:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read( void *buf, size_t count ) const; ANALYSIS SUMMARY: Hits = 55 Lines analyzed = 5141 in approximately 0.14 seconds (35697 lines/second) Physical Source Lines of Code (SLOC) = 3461 Hits@level = [0] 5 [1] 22 [2] 21 [3] 5 [4] 7 [5] 0 Hits@level+ = [0+] 60 [1+] 55 [2+] 33 [3+] 12 [4+] 7 [5+] 0 Hits/KSLOC@level+ = [0+] 17.336 [1+] 15.8914 [2+] 9.53482 [3+] 3.46721 [4+] 2.02254 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.