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/vrfy-990522/conf.h Examining data/vrfy-990522/exit.h Examining data/vrfy-990522/defs.h Examining data/vrfy-990522/pars.c Examining data/vrfy-990522/smtp.c Examining data/vrfy-990522/conn.c Examining data/vrfy-990522/util.c Examining data/vrfy-990522/vers.c Examining data/vrfy-990522/port.h Examining data/vrfy-990522/vrfy.h Examining data/vrfy-990522/mxrr.c Examining data/vrfy-990522/main.c Examining data/vrfy-990522/stat.c FINAL RESULTS: data/vrfy-990522/defs.h:126:7: [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). char *strcpy PROTO((char *, const char *)); data/vrfy-990522/defs.h:127:7: [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). char *strcat PROTO((char *, const char *)); data/vrfy-990522/main.c:598:9: [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. (void) fprintf(stderr, fmt, a, b, c, d); data/vrfy-990522/main.c:617:9: [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. (void) fprintf(stderr, fmt, a, b, c, d); data/vrfy-990522/main.c:645:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(msg, "554 %s", fmt); data/vrfy-990522/main.c:680:2: [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(fmt, a, b, c, d); data/vrfy-990522/pars.c:153:10: [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). (void) strcpy(copya, address); data/vrfy-990522/pars.c:172:10: [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). (void) strcpy(copyd, domain); data/vrfy-990522/smtp.c:603:10: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. (void) sprintf(SmtpMsgBuffer, fmt, a, b, c, d); data/vrfy-990522/smtp.c:724:11: [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). (void) strcpy(SmtpErrorBuffer, &SmtpReplyBuffer[4]); data/vrfy-990522/stat.c:115:11: [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). (void) strcpy(buf, strerror(err)); data/vrfy-990522/stat.c:119:11: [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). (void) strcat(buf, SmtpPhase); data/vrfy-990522/stat.c:124:11: [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). (void) strcat(buf, CurHostName); data/vrfy-990522/stat.c:134:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(buf, "Host %s is unreachable", CurHostName); data/vrfy-990522/stat.c:140:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(buf, "Connection refused by %s", CurHostName); data/vrfy-990522/stat.c:178:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(buf, "%s: %s", statstring(stat), p); data/vrfy-990522/stat.c:190:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(buf, "%s (%s)", statstring(stat), p); data/vrfy-990522/stat.c:193:10: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf(buf, "%s", statstring(stat)); data/vrfy-990522/vrfy.h:53:19: [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 newstr(s) strcpy(newstring(s), s) data/vrfy-990522/defs.h:138:7: [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. char *getenv PROTO((const char *)); data/vrfy-990522/main.c:271:11: [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. option = getenv("VRFY_LOCALHOST"); data/vrfy-990522/main.c:275:11: [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. option = getenv("VRFY_UUCPRELAY"); data/vrfy-990522/main.c:279:11: [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. option = getenv("VRFY_BITNETRELAY"); data/vrfy-990522/main.c:283:11: [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. option = getenv("VRFY_SINGLERELAY"); data/vrfy-990522/main.c:293:11: [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. option = getenv("VRFY_DEFAULTS"); data/vrfy-990522/conn.c:113: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. static char hostname[MAXHOST+1]; data/vrfy-990522/conn.c:263: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. static char hostname[MAXHOST+1]; data/vrfy-990522/main.c:215:1: [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 *ReplyList[MAXREPLY]; /* saved address expansions */ data/vrfy-990522/main.c:218:1: [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 *AddrChain[MAXLOOP]; /* address chain in recursive mode */ data/vrfy-990522/main.c:225: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. extern char *MxHosts[MAXMXHOSTS]; /* names of mx hosts found */ data/vrfy-990522/main.c:570:13: [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). optvalue = atoi(optstring); data/vrfy-990522/main.c:638:2: [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 msg[BUFSIZ]; /* status message buffer */ data/vrfy-990522/main.c:797:2: [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 *replylist[MAXREPLY]; /* local copy of replies */ data/vrfy-990522/main.c:800:2: [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 oldaddr[MAXSPEC+1]; /* parsed original address */ data/vrfy-990522/main.c:801:2: [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 newaddr[MAXSPEC+1]; /* parsed reply to address */ data/vrfy-990522/main.c:802:2: [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 hostbuf[MAXHOST+1]; /* local copy of domain part */ data/vrfy-990522/main.c:923:2: [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 buf[BUFSIZ]; data/vrfy-990522/main.c:942:8: [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). fp = fopen(filename, "r"); data/vrfy-990522/main.c:1087:2: [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 addrbuf[MAXSPEC+1]; /* plain address without comment */ data/vrfy-990522/main.c:1088:2: [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 hostbuf[MAXHOST+1]; /* local copy of domain part */ data/vrfy-990522/main.c:1090:2: [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 *mxhosts[MAXMXHOSTS]; /* local copy of mx hosts */ data/vrfy-990522/main.c:1672: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. static char addrbuf[MAXSPEC+1]; /* parsed plain address */ data/vrfy-990522/mxrr.c:53: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 hostbuf[MAXMXBUFSIZ]; data/vrfy-990522/mxrr.c:55:1: [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 *MxHosts[MAXMXHOSTS]; /* list of names of mx hosts found */ data/vrfy-990522/pars.c:207: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. static char buf[MAXSPEC+1]; /* saved plain address */ data/vrfy-990522/port.h:121:9: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define bcopy(a,b,n) (void) memcpy(b,a,n) data/vrfy-990522/port.h:121:29: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define bcopy(a,b,n) (void) memcpy(b,a,n) data/vrfy-990522/smtp.c:37:1: [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 SmtpMsgBuffer[BUFSIZ]; /* buffer for outgoing commands */ data/vrfy-990522/smtp.c:38:1: [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 SmtpReplyBuffer[BUFSIZ]; /* buffer for incoming replies (first line) */ data/vrfy-990522/smtp.c:39:1: [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 SmtpContBuffer[BUFSIZ]; /* buffer for incoming replies (continuation) */ data/vrfy-990522/smtp.c:40:1: [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 SmtpErrorBuffer[BUFSIZ]; /* saved temporary failure error messages */ data/vrfy-990522/smtp.c:675:12: [2] (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). Risk is low because the source is a constant string. (void) strcpy(SmtpErrorBuffer, "Connection closed"); data/vrfy-990522/smtp.c:708:7: [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). r = atoi(buf); data/vrfy-990522/stat.c:75: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. static char buf[BUFSIZ]; data/vrfy-990522/stat.c:79:10: [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. (void) sprintf(buf, "250 Ok"); data/vrfy-990522/stat.c:86:10: [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. (void) sprintf(buf, "554 Unknown status %d", stat + EX__BASE); data/vrfy-990522/stat.c:105: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. static char buf[BUFSIZ]; data/vrfy-990522/stat.c:113:11: [2] (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). Risk is low because the source is a constant string. (void) strcpy(buf, "Connection reset"); data/vrfy-990522/stat.c:118:11: [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. (void) strcat(buf, " during "); data/vrfy-990522/stat.c:123:11: [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. (void) strcat(buf, " with "); data/vrfy-990522/stat.c:159:2: [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 buf[BUFSIZ]; data/vrfy-990522/util.c:108: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. static char buf[BUFSIZ]; /* expanded string buffer */ data/vrfy-990522/util.c:175: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. static char buf[30]; /* sufficient for 64-bit values */ data/vrfy-990522/util.c:177: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. (void) sprintf(buf, "%d", n); data/vrfy-990522/conn.c:174:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(hostname, host, MAXHOST); data/vrfy-990522/conn.c:321:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). (void) strncpy(hostname, hp->h_name, MAXHOST); data/vrfy-990522/defs.h:128:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). char *strncpy PROTO((char *, const char *, siz_t)); data/vrfy-990522/vrfy.h:52:60: [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 newstring(s) (char *)xalloc((ptr_t *)NULL, (siz_t)(strlen(s)+1)) data/vrfy-990522/vrfy.h:58:27: [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 strlength(a) (int)strlen(a) ANALYSIS SUMMARY: Hits = 69 Lines analyzed = 4549 in approximately 0.13 seconds (33711 lines/second) Physical Source Lines of Code (SLOC) = 2346 Hits@level = [0] 26 [1] 5 [2] 39 [3] 6 [4] 19 [5] 0 Hits@level+ = [0+] 95 [1+] 69 [2+] 64 [3+] 25 [4+] 19 [5+] 0 Hits/KSLOC@level+ = [0+] 40.4945 [1+] 29.4118 [2+] 27.2805 [3+] 10.6564 [4+] 8.09889 [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.