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/a56-1.3+dfsg/getopt.c Examining data/a56-1.3+dfsg/torom.c Examining data/a56-1.3+dfsg/keybld.c Examining data/a56-1.3+dfsg/toktab.c Examining data/a56-1.3+dfsg/frac2int.c Examining data/a56-1.3+dfsg/debian/a56-tobin.c Examining data/a56-1.3+dfsg/debian/bin2h.c Examining data/a56-1.3+dfsg/toomf.c Examining data/a56-1.3+dfsg/a56.h Examining data/a56-1.3+dfsg/lex.c Examining data/a56-1.3+dfsg/subs.c Examining data/a56-1.3+dfsg/main.c FINAL RESULTS: data/a56-1.3+dfsg/keybld.c:29:8: [5] (buffer) gets: Does not check for buffer overflows (CWE-120, CWE-20). Use fgets() instead. while(gets(buf)) { data/a56-1.3+dfsg/toomf.c:46:8: [5] (buffer) gets: Does not check for buffer overflows (CWE-120, CWE-20). Use fgets() instead. while(gets(buf)) { data/a56-1.3+dfsg/torom.c:41:8: [5] (buffer) gets: Does not check for buffer overflows (CWE-120, CWE-20). Use fgets() instead. while(gets(buf)) { data/a56-1.3+dfsg/a56.h:90: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). (char *)strcpy((char *)malloc(strlen(s)+1),(s)) : NULL) data/a56-1.3+dfsg/frac2int.c:56:37: [4] (shell) system: 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. complement, fractional system. data/a56-1.3+dfsg/lex.c:474: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(c < ' ' ? "<\\z%02X>%s" : "<%c>", c, c == '\n' ? "\n" : ""); data/a56-1.3+dfsg/subs.c:72:2: [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, c, a1, a2, a3, a4, a5, a6, a7, a8); data/a56-1.3+dfsg/getopt.c:51:1: [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. getopt(nargc,nargv,ostr) data/a56-1.3+dfsg/getopt.c:112:14: [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, optstring)) != EOF) data/a56-1.3+dfsg/main.c:55:13: [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, "bldo:")) != EOF) switch (c) { data/a56-1.3+dfsg/debian/a56-tobin.c:42:8: [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 (argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644); data/a56-1.3+dfsg/debian/bin2h.c:32:20: [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). bytes_per_line = atoi (argv[1]); data/a56-1.3+dfsg/keybld.c:23: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 buf[1024]; data/a56-1.3+dfsg/keybld.c:137: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 tmp[1024]; data/a56-1.3+dfsg/keybld.c:156:3: [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. strcpy(tmp, "<nothing>"); data/a56-1.3+dfsg/lex.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 tok[MAX_TOK]; data/a56-1.3+dfsg/lex.c:71:20: [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). yylval.n.val.i = atoi(tok); data/a56-1.3+dfsg/lex.c:437: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 line_buf[INLINE]; data/a56-1.3+dfsg/main.c: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. static char list[MAX], *lp; data/a56-1.3+dfsg/main.c:261:3: [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(list, "%06X<", word); data/a56-1.3+dfsg/main.c:270:3: [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(list, "%06X", word); data/a56-1.3+dfsg/main.c:275: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 *spacespace[2] = { data/a56-1.3+dfsg/main.c:294: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 fixbuf[1024]; data/a56-1.3+dfsg/subs.c:40:17: [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 ((fp = fopen(file, "r")) == NULL) { data/a56-1.3+dfsg/subs.c:51:12: [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). if ((fp = fopen(file, "w")) == NULL) { data/a56-1.3+dfsg/subs.c:62:12: [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). if ((fp = fopen(file, "a")) == NULL) { data/a56-1.3+dfsg/subs.c:79: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 tabbuf[MAX_BUF], *untabn(); data/a56-1.3+dfsg/toomf.c:40: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[MAX]; data/a56-1.3+dfsg/torom.c:37: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[MAX]; data/a56-1.3+dfsg/a56.h:90: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). (char *)strcpy((char *)malloc(strlen(s)+1),(s)) : NULL) data/a56-1.3+dfsg/a56.h:93:24: [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 rmcr(s) {if (s[strlen(s)-1] == '\n') s[strlen(s)-1] = '\0';}; data/a56-1.3+dfsg/a56.h:93:48: [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 rmcr(s) {if (s[strlen(s)-1] == '\n') s[strlen(s)-1] = '\0';}; data/a56-1.3+dfsg/debian/bin2h.c:34:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). b = getchar (); data/a56-1.3+dfsg/debian/bin2h.c:44:11: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). b = getchar (); data/a56-1.3+dfsg/debian/bin2h.c:52:8: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). b = getchar (); data/a56-1.3+dfsg/keybld.c:153:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tmp, buf, tp - buf); data/a56-1.3+dfsg/subs.c:96:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(b, s, MAX_BUF); ANALYSIS SUMMARY: Hits = 37 Lines analyzed = 2081 in approximately 0.06 seconds (35212 lines/second) Physical Source Lines of Code (SLOC) = 1545 Hits@level = [0] 54 [1] 8 [2] 19 [3] 3 [4] 4 [5] 3 Hits@level+ = [0+] 91 [1+] 37 [2+] 29 [3+] 10 [4+] 7 [5+] 3 Hits/KSLOC@level+ = [0+] 58.8997 [1+] 23.9482 [2+] 18.7702 [3+] 6.47249 [4+] 4.53074 [5+] 1.94175 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.