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/mailsync-5.2.7/src/c-client-header.h Examining data/mailsync-5.2.7/src/c-client_callbacks.cc Examining data/mailsync-5.2.7/src/channel.cc Examining data/mailsync-5.2.7/src/channel.h Examining data/mailsync-5.2.7/src/commandline.cc Examining data/mailsync-5.2.7/src/commandline.h Examining data/mailsync-5.2.7/src/configuration.cc Examining data/mailsync-5.2.7/src/configuration.h Examining data/mailsync-5.2.7/src/mail_handling.cc Examining data/mailsync-5.2.7/src/mail_handling.h Examining data/mailsync-5.2.7/src/main.cc Examining data/mailsync-5.2.7/src/msgid.cc Examining data/mailsync-5.2.7/src/msgid.h Examining data/mailsync-5.2.7/src/msgstring.c Examining data/mailsync-5.2.7/src/msgstring.h Examining data/mailsync-5.2.7/src/options.h Examining data/mailsync-5.2.7/src/password.cc Examining data/mailsync-5.2.7/src/password.h Examining data/mailsync-5.2.7/src/store.cc Examining data/mailsync-5.2.7/src/store.h Examining data/mailsync-5.2.7/src/types.cc Examining data/mailsync-5.2.7/src/types.h Examining data/mailsync-5.2.7/src/utils.cc Examining data/mailsync-5.2.7/src/utils.h FINAL RESULTS: data/mailsync-5.2.7/src/c-client_callbacks.cc:212:18: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). if (*mb->user) strcpy (username,mb->user); data/mailsync-5.2.7/src/c-client_callbacks.cc:218:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (password,getpass (" password: ")); data/mailsync-5.2.7/src/c-client_callbacks.cc:218:22: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. strcpy (password,getpass (" password: ")); data/mailsync-5.2.7/src/c-client_callbacks.cc:220:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (password, current_context_passwd->text.c_str()); data/mailsync-5.2.7/src/commandline.cc:22:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf(PACKAGE_STRING "\n\n"); // autoconf bizzarrerie data/mailsync-5.2.7/src/configuration.cc:45:3: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stderr, errorMessage, insertIntoMessage ? insertIntoMessage : ""); data/mailsync-5.2.7/src/mail_handling.cc:99:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( lead_format, action, direction); data/mailsync-5.2.7/src/mail_handling.cc:122:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( from_format, &from[0]); data/mailsync-5.2.7/src/mail_handling.cc:131:3: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf( msgid_format, msgid); data/mailsync-5.2.7/src/configuration.cc:292:12: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. home = getenv( "HOME" ); data/mailsync-5.2.7/src/main.cc:114:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. env_init( getenv("USER"), getenv("HOME")); data/mailsync-5.2.7/src/main.cc:114:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. env_init( getenv("USER"), getenv("HOME")); data/mailsync-5.2.7/src/channel.cc:283:3: [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 flags[MAILTMPLEN]; data/mailsync-5.2.7/src/channel.cc:284:3: [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 msgdate[MAILTMPLEN]; data/mailsync-5.2.7/src/channel.cc:341:22: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if (elt->seen) strcat (flags," \\Seen"); data/mailsync-5.2.7/src/channel.cc:345:22: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if (elt->deleted) strcat (flags," \\Deleted"); data/mailsync-5.2.7/src/channel.cc:346:22: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if (elt->flagged) strcat (flags," \\Flagged"); data/mailsync-5.2.7/src/channel.cc:347:22: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if (elt->answered) strcat (flags," \\Answered"); data/mailsync-5.2.7/src/channel.cc:348:22: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. if (elt->draft) strcat (flags," \\Draft"); data/mailsync-5.2.7/src/channel.cc:426:7: [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 seq[30]; data/mailsync-5.2.7/src/channel.cc:427:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(seq,"%lu",msgno); data/mailsync-5.2.7/src/channel.cc:442:9: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). f = tmpfile(); data/mailsync-5.2.7/src/configuration.cc:305:25: [2] (misc) fopen: 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). || !( config = fopen( config_file.c_str(), "r") ) ) data/mailsync-5.2.7/src/mail_handling.cc:108:10: [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 char from[66] = ""; data/mailsync-5.2.7/src/msgid.cc:30:13: [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 buf[MD5BLKLEN]; /* input buffer */ data/mailsync-5.2.7/src/msgid.cc:83:9: [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 addr[4096]; data/mailsync-5.2.7/src/msgid.cc:102:20: [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 bdigest[MD5DIGLEN]; data/mailsync-5.2.7/src/msgid.cc:104:11: [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 cdigest[2 * MD5DIGLEN + 2]; data/mailsync-5.2.7/src/msgid.cc:110:13: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(&cdigest[2 * i],"%02x",bdigest[i]); data/mailsync-5.2.7/src/store.cc:255:9: [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 seq[30]; data/mailsync-5.2.7/src/store.cc:256:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( seq, "%lu", msgno); data/mailsync-5.2.7/src/store.cc:396: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 seq[30]; data/mailsync-5.2.7/src/store.cc:397:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( seq, "%lu", msgno); data/mailsync-5.2.7/src/configuration.cc:76:9: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(f); data/mailsync-5.2.7/src/configuration.cc:81:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(f); data/mailsync-5.2.7/src/configuration.cc:108:23: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). t->buf += (char)getc(f); data/mailsync-5.2.7/src/msgid.cc:107:59: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). md5_update(&ctx, (unsigned char *) str.c_str(), strlen(str.c_str()) ); data/mailsync-5.2.7/src/msgid.cc:237:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). start += strlen(md5_start); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 3543 in approximately 0.16 seconds (22456 lines/second) Physical Source Lines of Code (SLOC) = 2306 Hits@level = [0] 180 [1] 5 [2] 21 [3] 3 [4] 9 [5] 0 Hits@level+ = [0+] 218 [1+] 38 [2+] 33 [3+] 12 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 94.536 [1+] 16.4788 [2+] 14.3105 [3+] 5.20382 [4+] 3.90286 [5+] 0 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.