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/xfpt-0.11/src/globals.h Examining data/xfpt-0.11/src/globals.c Examining data/xfpt-0.11/src/mytypes.h Examining data/xfpt-0.11/src/dot.c Examining data/xfpt-0.11/src/functions.h Examining data/xfpt-0.11/src/xfpt.h Examining data/xfpt-0.11/src/para.c Examining data/xfpt-0.11/src/xfpt.c Examining data/xfpt-0.11/src/read.c Examining data/xfpt-0.11/src/misc.c Examining data/xfpt-0.11/src/error.c Examining data/xfpt-0.11/src/literal.c Examining data/xfpt-0.11/src/tree.c Examining data/xfpt-0.11/src/structs.h FINAL RESULTS: data/xfpt-0.11/src/mytypes.h:57: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(CCS(s),n) data/xfpt-0.11/src/mytypes.h:58: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(CCS(s),n,m) data/xfpt-0.11/src/dot.c:372:8: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. else sprintf(CS ist->filename, "%s/%s", xfpt_share, p); data/xfpt-0.11/src/error.c:130:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vfprintf(stderr, error_data[n].text, ap); data/xfpt-0.11/src/mytypes.h:22: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/xfpt-0.11/src/mytypes.h:72: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),CCS(t)) data/xfpt-0.11/src/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),CCS(t)) data/xfpt-0.11/src/read.c:166:25: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. if (arg != NULL) b += sprintf(CS b, "%s", arg->string); data/xfpt-0.11/src/read.c:259:11: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(CS inbuffer, "%s\n", ps->string); data/xfpt-0.11/src/read.c:275:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void)sprintf(CS inbuffer, "%s\n", ps->string); data/xfpt-0.11/src/dot.c:560:7: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void)memcpy(nonlbuffer, p, len); data/xfpt-0.11/src/dot.c:655:1: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ps->string, p, length); data/xfpt-0.11/src/misc.c:113:1: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(yield, p, length); data/xfpt-0.11/src/misc.c:227:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(yield, pp, length); data/xfpt-0.11/src/mytypes.h:54: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(CCS(s)) data/xfpt-0.11/src/mytypes.h:55: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(CCS(s)) data/xfpt-0.11/src/mytypes.h:60: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(CCS(s),CCS(t)) data/xfpt-0.11/src/mytypes.h:65: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(CCS(s),(n)|O_BINARY,m) /* where all files must */ data/xfpt-0.11/src/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(CCS(s),n,m) /* to avoid problems */ data/xfpt-0.11/src/read.c:391:1: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(q, p, length); data/xfpt-0.11/src/read.c:433:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(q, p, length); data/xfpt-0.11/src/mytypes.h:69: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/xfpt-0.11/src/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(CCS(s)) data/xfpt-0.11/src/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),CCS(t),n) data/xfpt-0.11/src/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),CCS(t),n) data/xfpt-0.11/src/read.c:199:7: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = fgetc(f); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 3163 in approximately 0.10 seconds (33063 lines/second) Physical Source Lines of Code (SLOC) = 1750 Hits@level = [0] 43 [1] 5 [2] 11 [3] 0 [4] 8 [5] 2 Hits@level+ = [0+] 69 [1+] 26 [2+] 21 [3+] 10 [4+] 10 [5+] 2 Hits/KSLOC@level+ = [0+] 39.4286 [1+] 14.8571 [2+] 12 [3+] 5.71429 [4+] 5.71429 [5+] 1.14286 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.