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/libcompface-1.5.2/arith.c Examining data/libcompface-1.5.2/cmain.c Examining data/libcompface-1.5.2/compface_private.h Examining data/libcompface-1.5.2/compress.c Examining data/libcompface-1.5.2/config.h Examining data/libcompface-1.5.2/data.h Examining data/libcompface-1.5.2/gen.c Examining data/libcompface-1.5.2/uncmain.c Examining data/libcompface-1.5.2/uncompface.c Examining data/libcompface-1.5.2/version.c Examining data/libcompface-1.5.2/compface.c Examining data/libcompface-1.5.2/file.c Examining data/libcompface-1.5.2/compface.h FINAL RESULTS: data/libcompface-1.5.2/cmain.c:52:27: [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 INITERR(s) {(void)strcpy(fbuf, cmdname); (void)strcat(fbuf, ": ");\ data/libcompface-1.5.2/cmain.c:53:12: [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(fbuf, (s));} data/libcompface-1.5.2/cmain.c:54:25: [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 ADDERR(s) (void)strcat(fbuf, (s)); data/libcompface-1.5.2/cmain.c:57: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 INITWARN(s) {(void)strcpy(fbuf, cmdname);\ data/libcompface-1.5.2/cmain.c:59:12: [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(fbuf, (s));} data/libcompface-1.5.2/cmain.c:60:26: [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 ADDWARN(s) (void)strcat(fbuf, (s)); data/libcompface-1.5.2/file.c:99:11: [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 (sscanf(s, "static %s %s", type1,type2)==2 && data/libcompface-1.5.2/uncmain.c:48:27: [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 INITERR(s) {(void)strcpy(fbuf, cmdname); (void)strcat(fbuf, ": ");\ data/libcompface-1.5.2/uncmain.c:49:12: [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(fbuf, (s));} data/libcompface-1.5.2/uncmain.c:50:25: [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 ADDERR(s) (void)strcat(fbuf, (s)); data/libcompface-1.5.2/uncmain.c:53: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 INITWARN(s) {(void)strcpy(fbuf, cmdname);\ data/libcompface-1.5.2/uncmain.c:55:12: [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(fbuf, (s));} data/libcompface-1.5.2/uncmain.c:56:26: [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 ADDWARN(s) (void)strcat(fbuf, (s)); data/libcompface-1.5.2/cmain.c:26: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 fbuf[FACEBUFLEN]; data/libcompface-1.5.2/cmain.c:52:56: [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. #define INITERR(s) {(void)strcpy(fbuf, cmdname); (void)strcat(fbuf, ": ");\ data/libcompface-1.5.2/cmain.c:58:12: [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(fbuf, ": (warning) ");\ data/libcompface-1.5.2/cmain.c:84:21: [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). if ((infile = open(inname, O_RDONLY)) == -1) data/libcompface-1.5.2/cmain.c:96:22: [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). if ((outfile = open(outname, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) data/libcompface-1.5.2/compface.h:42: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 F[PIXELS]; data/libcompface-1.5.2/compface.h:83: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 g_00[1<<12]; data/libcompface-1.5.2/compface.h:84: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 g_01[1<<7]; data/libcompface-1.5.2/compface.h:85: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 g_02[1<<2]; data/libcompface-1.5.2/compface.h:86: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 g_10[1<<9]; data/libcompface-1.5.2/compface.h:87: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 g_20[1<<6]; data/libcompface-1.5.2/compface.h:88: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 g_30[1<<8]; data/libcompface-1.5.2/compface.h:89: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 g_40[1<<10]; data/libcompface-1.5.2/compface.h:90: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 g_11[1<<5]; data/libcompface-1.5.2/compface.h:91: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 g_21[1<<3]; data/libcompface-1.5.2/compface.h:92: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 g_31[1<<5]; data/libcompface-1.5.2/compface.h:93: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 g_41[1<<6]; data/libcompface-1.5.2/compface.h:94: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 g_12[1<<1]; data/libcompface-1.5.2/compface.h:95: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 g_22[1<<0]; data/libcompface-1.5.2/compface.h:96: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 g_32[1<<2]; data/libcompface-1.5.2/compface.h:97: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 g_42[1<<2]; data/libcompface-1.5.2/compface_private.h:25: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 F[PIXELS]; data/libcompface-1.5.2/file.c:46: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[DIGITS]; data/libcompface-1.5.2/file.c:92:4: [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 type1[256]; data/libcompface-1.5.2/file.c:93:4: [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 type2[256]; data/libcompface-1.5.2/file.c:178: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(t,"#define noname_width 48\n#define noname_height 48\nstatic char noname_bits[] = {\n "); data/libcompface-1.5.2/file.c:226: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(t, "};\n"); data/libcompface-1.5.2/gen.c:97: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 new[PIXELS]; data/libcompface-1.5.2/uncmain.c:26: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 fbuf[FACEBUFLEN]; data/libcompface-1.5.2/uncmain.c:48:56: [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. #define INITERR(s) {(void)strcpy(fbuf, cmdname); (void)strcat(fbuf, ": ");\ data/libcompface-1.5.2/uncmain.c:54:12: [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(fbuf, ": (warning) ");\ data/libcompface-1.5.2/uncmain.c:87:21: [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). if ((infile = open(inname, O_RDONLY)) == -1) data/libcompface-1.5.2/uncmain.c:99:22: [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). if ((outfile = open(outname, O_WRONLY | O_CREAT | O_TRUNC, 0644)) == -1) data/libcompface-1.5.2/cmain.c:55:22: [1] (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 character. #define ERROR {(void)strcat(fbuf, "\n");\ data/libcompface-1.5.2/cmain.c:56:26: [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). (void)write(2, fbuf, strlen(fbuf)); exit(1);} data/libcompface-1.5.2/cmain.c:61:21: [1] (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 character. #define WARN {(void)strcat(fbuf, "\n"); (void)write(2, fbuf, strlen(fbuf));} data/libcompface-1.5.2/cmain.c:61:62: [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 WARN {(void)strcat(fbuf, "\n"); (void)write(2, fbuf, strlen(fbuf));} data/libcompface-1.5.2/cmain.c:131: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). t = s + strlen(s); data/libcompface-1.5.2/cmain.c:155:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (len = read(infile, t, FACEBUFLEN - count)) data/libcompface-1.5.2/file.c:116: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). for(i = strlen(s); i > 0; i--) data/libcompface-1.5.2/uncmain.c:51:22: [1] (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 character. #define ERROR {(void)strcat(fbuf, "\n");\ data/libcompface-1.5.2/uncmain.c:52:26: [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). (void)write(2, fbuf, strlen(fbuf)); exit(1);} data/libcompface-1.5.2/uncmain.c:57:21: [1] (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 character. #define WARN {(void)strcat(fbuf, "\n"); (void)write(2, fbuf, strlen(fbuf));} data/libcompface-1.5.2/uncmain.c:57:62: [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 WARN {(void)strcat(fbuf, "\n"); (void)write(2, fbuf, strlen(fbuf));} data/libcompface-1.5.2/uncmain.c:134: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). t = s + strlen(s); data/libcompface-1.5.2/uncmain.c:158:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (len = read(infile, t, FACEBUFLEN - count)) ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 1944 in approximately 0.11 seconds (17810 lines/second) Physical Source Lines of Code (SLOC) = 1577 Hits@level = [0] 6 [1] 13 [2] 33 [3] 0 [4] 13 [5] 0 Hits@level+ = [0+] 65 [1+] 59 [2+] 46 [3+] 13 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 41.2175 [1+] 37.4128 [2+] 29.1693 [3+] 8.2435 [4+] 8.2435 [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.