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/sa-exim-4.2.1/accept.c Examining data/sa-exim-4.2.1/eximinc/local_scan.h Examining data/sa-exim-4.2.1/eximinc/store.h Examining data/sa-exim-4.2.1/eximinc/mytypes.h Examining data/sa-exim-4.2.1/sa-exim.c FINAL RESULTS: data/sa-exim-4.2.1/eximinc/mytypes.h:60:28: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. #define Uchmod(s,n) chmod(CS(s),n) data/sa-exim-4.2.1/eximinc/mytypes.h:61:28: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. #define Uchown(s,n,m) chown(CS(s),n,m) data/sa-exim-4.2.1/eximinc/mytypes.h:26:48: [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. #define PRINTF_FUNCTION __attribute__((format(printf,1,2))) data/sa-exim-4.2.1/eximinc/mytypes.h:74:28: [4] (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). #define Ustrcat(s,t) strcat(CS(s),CS(t)) data/sa-exim-4.2.1/eximinc/mytypes.h:77:28: [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). #define Ustrcpy(s,t) strcpy(CS(s),CS(t)) data/sa-exim-4.2.1/sa-exim.c:674:7: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(buffer, #VAR ": " TYPE, &VAR)) \ data/sa-exim-4.2.1/sa-exim.c:974:6: [4] (shell) execv: 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. ret=execv(SAspamcpath, spamc_argv); data/sa-exim-4.2.1/eximinc/mytypes.h:57:28: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). #define Uatoi(s) atoi(CS(s)) data/sa-exim-4.2.1/eximinc/mytypes.h:58:28: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). #define Uatol(s) atol(CS(s)) data/sa-exim-4.2.1/eximinc/mytypes.h:63:28: [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). #define Ufopen(s,t) fopen(CS(s),CS(t)) data/sa-exim-4.2.1/eximinc/mytypes.h:67:28: [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). #define Uopen(s,n,m) open(CS(s),(n)|O_BINARY,m) /* where all files must */ data/sa-exim-4.2.1/eximinc/mytypes.h:69:28: [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). #define Uopen(s,n,m) open(CS(s),n,m) /* to avoid problems */ data/sa-exim-4.2.1/sa-exim.c:86:8: [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 *buffera[4096]; data/sa-exim-4.2.1/sa-exim.c:520: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 *spamc_argv[10]; data/sa-exim-4.2.1/sa-exim.c:653:6: [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). ret=open(conffile, 0); data/sa-exim-4.2.1/sa-exim.c:1301:2: [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(buffer, "%d", ret); data/sa-exim-4.2.1/eximinc/mytypes.h:71:28: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define Uread(f,b,l) read(f,CS(b),l) data/sa-exim-4.2.1/eximinc/mytypes.h:80:33: [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). #define Ustrlen(s) (int)strlen(CS(s)) data/sa-exim-4.2.1/eximinc/mytypes.h:81:28: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. #define Ustrncat(s,t,n) strncat(CS(s),CS(t),n) data/sa-exim-4.2.1/eximinc/mytypes.h:83:28: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). #define Ustrncpy(s,t,n) strncpy(CS(s),CS(t),n) data/sa-exim-4.2.1/sa-exim.c:127:21: [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). for (idx=0; idx<strlen(referenceheader); idx++) data/sa-exim-4.2.1/sa-exim.c:256:38: [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). stret=write(writefd, fake_env_from, strlen(fake_env_from)); data/sa-exim-4.2.1/sa-exim.c:271:31: [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). stret=write(writefd,hl->text,strlen(hl->text)); data/sa-exim-4.2.1/sa-exim.c:290:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (towrite>0 && (stret=read(readfd, buffer, MIN(sizeof(buffera), towrite))) > 0) data/sa-exim-4.2.1/sa-exim.c:334:9: [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). if (strlen(rcptlist) <= SAmaxrcptlistlength) data/sa-exim-4.2.1/sa-exim.c:406:17: [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). if (buffer[strlen(buffer)-1] == '\n') data/sa-exim-4.2.1/sa-exim.c:408:10: [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). buffer[strlen(buffer)-1]=0; data/sa-exim-4.2.1/sa-exim.c:410:14: [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). if (buffer[strlen(buffer)-1] == '\r') data/sa-exim-4.2.1/sa-exim.c:412:14: [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). buffer[strlen(buffer)-1]=0; data/sa-exim-4.2.1/sa-exim.c:426:10: [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). if (strlen(*header) < 8000) data/sa-exim-4.2.1/sa-exim.c:699:23: [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). VAR = strdup(buffer+strlen( #VAR )+2); \ data/sa-exim-4.2.1/sa-exim.c:706:11: [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). if (VAR[strlen(VAR)-1] == '\n') \ data/sa-exim-4.2.1/sa-exim.c:708:11: [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). VAR[strlen(VAR)-1]=0; \ data/sa-exim-4.2.1/sa-exim.c:792:39: [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). for (i=1; i < recipients_count && strlen((char *)rcptlist) < 7998 - strlen(recipients_list[i].address); i++) data/sa-exim-4.2.1/sa-exim.c:792:73: [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). for (i=1; i < recipients_count && strlen((char *)rcptlist) < 7998 - strlen(recipients_list[i].address); i++) data/sa-exim-4.2.1/sa-exim.c:1007:34: [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). stret=write(writefd[1],hl->text,strlen(hl->text)); data/sa-exim-4.2.1/sa-exim.c:1022:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (towrite>0 && (stret=read(fd, buffer, MIN(sizeof(buffera), towrite))) > 0) data/sa-exim-4.2.1/sa-exim.c:1083:13: [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). if (buffer[strlen(buffer)-1] == '\n') data/sa-exim-4.2.1/sa-exim.c:1085:13: [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). buffer[strlen(buffer)-1]=0; data/sa-exim-4.2.1/sa-exim.c:1087:17: [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). if (buffer[strlen(buffer)-1] == '\r') data/sa-exim-4.2.1/sa-exim.c:1089:10: [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). buffer[strlen(buffer)-1]=0; data/sa-exim-4.2.1/sa-exim.c:1260:84: [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). log_write(0, LOG_MAIN, "SA: Debug9: Read body from SA; line %d (read %d)", line, strlen(buffer)); data/sa-exim-4.2.1/sa-exim.c:1263:30: [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). stret=write(fd, buffer, strlen(buffer)); data/sa-exim-4.2.1/sa-exim.c:1269:17: [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). if (buffer[strlen(buffer)-1] == '\n') ANALYSIS SUMMARY: Hits = 44 Lines analyzed = 1893 in approximately 0.09 seconds (20796 lines/second) Physical Source Lines of Code (SLOC) = 1331 Hits@level = [0] 2 [1] 28 [2] 9 [3] 0 [4] 5 [5] 2 Hits@level+ = [0+] 46 [1+] 44 [2+] 16 [3+] 7 [4+] 7 [5+] 2 Hits/KSLOC@level+ = [0+] 34.5605 [1+] 33.0579 [2+] 12.021 [3+] 5.2592 [4+] 5.2592 [5+] 1.50263 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.