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/cdecl-2.5/cdecl.c FINAL RESULTS: data/cdecl-2.5/cdecl.c:121:46: [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. # define Debug(x) do { if (DebugFlag) (void) fprintf x; } while (0) data/cdecl-2.5/cdecl.c:573:9: [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(newstr,str); data/cdecl-2.5/cdecl.c:591:9: [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(p,s); data/cdecl-2.5/cdecl.c:644:9: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). (void) mktemp(*listp); data/cdecl-2.5/cdecl.c:746:13: [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. (void) printf(fmt, p->cpptext); data/cdecl-2.5/cdecl.c:748:13: [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. (void) printf(fmt, p->text); data/cdecl-2.5/cdecl.c:902:3: [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(line, oldline); data/cdecl-2.5/cdecl.c:1156: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). { prompting = 1; strcpy(cdecl_prompt, real_prompt); } data/cdecl-2.5/cdecl.c:1293:2: [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(cdecl_prompt, real_prompt); data/cdecl-2.5/cdecl.c:145:7: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt(); data/cdecl-2.5/cdecl.c:674:5: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt(argc,argv,optstring) data/cdecl-2.5/cdecl.c:1267:17: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt(argc, argv, "cipqrpa+dDV")) != EOF) data/cdecl-2.5/cdecl.c:104: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 cdecl_prompt[MAX_NAME+3]; data/cdecl-2.5/cdecl.c:107: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 real_prompt[MAX_NAME+3]; data/cdecl-2.5/cdecl.c:154:9: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE *tmpfile(); data/cdecl-2.5/cdecl.c:209: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 crosscheck[9][9] = { data/cdecl-2.5/cdecl.c:604:12: [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[5]; data/cdecl-2.5/cdecl.c:613: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,"\\%03o",c); data/cdecl-2.5/cdecl.c:629:7: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE *tmpfile() data/cdecl-2.5/cdecl.c:645:10: [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). retfp = fopen(*listp, "w+"); data/cdecl-2.5/cdecl.c:926:19: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE *tmpfp = tmpfile(); data/cdecl-2.5/cdecl.c:967:19: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). FILE *tmpfp = tmpfile(); data/cdecl-2.5/cdecl.c:1021:18: [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). else if ((ifp = fopen(argv[optind], "r")) == NULL) data/cdecl-2.5/cdecl.c:414: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). len = strlen(text); data/cdecl-2.5/cdecl.c:431: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). len = strlen(text); data/cdecl-2.5/cdecl.c:556: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). len += strlen(str); data/cdecl-2.5/cdecl.c:588:42: [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). register char *p = malloc((unsigned)(strlen(s)+1)); data/cdecl-2.5/cdecl.c:836:8: [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). len = strlen(progname); data/cdecl-2.5/cdecl.c:838:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(real_prompt, progname, len); data/cdecl-2.5/cdecl.c:897:12: [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). len = strlen(line); data/cdecl-2.5/cdecl.c:1044:16: [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). int lenl = strlen(left), lenr = strlen(right); data/cdecl-2.5/cdecl.c:1044:37: [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). int lenl = strlen(left), lenr = strlen(right); data/cdecl-2.5/cdecl.c:1142: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(constvol) > 0) ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 1313 in approximately 0.05 seconds (25087 lines/second) Physical Source Lines of Code (SLOC) = 1001 Hits@level = [0] 66 [1] 10 [2] 11 [3] 3 [4] 9 [5] 0 Hits@level+ = [0+] 99 [1+] 33 [2+] 23 [3+] 12 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 98.9011 [1+] 32.967 [2+] 22.977 [3+] 11.988 [4+] 8.99101 [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.