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/pscan-1.2/pscan.c Examining data/pscan-1.2/pscan.h Examining data/pscan-1.2/test.c FINAL RESULTS: data/pscan-1.2/pscan.c:171: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. num = sscanf(buffer, "%s%d", name, &offset); data/pscan-1.2/test.c:38:1: [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, variable); /* problematic */ data/pscan-1.2/test.c:44:1: [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, format, variable1, variable2); data/pscan-1.2/test.c:61:1: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s"); /* OK */ data/pscan-1.2/test.c:66:1: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buffer, variable); /* problematic */ data/pscan-1.2/test.c:71:1: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s", variable); /* OK */ data/pscan-1.2/test.c:77:23: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buffer, "%d", sprintf(buffer1, variable)); /* problematic! */ data/pscan-1.2/test.c:95:1: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(buffer, data/pscan-1.2/test.c:103:1: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s %s %s", one, two, three); /* OK */ data/pscan-1.2/test.c:108:1: [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((variable ? "%4" : "%3s"), string); /* OK */ data/pscan-1.2/test.c:113:1: [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((variable ? fmt1 : fmt2), string3); /* OK */ data/pscan-1.2/test.c:118:1: [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((variable ? string1 : string2)); /* problematic */ data/pscan-1.2/test.c:129:1: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(s, "PASV port %i assigned to %s", i, remoteident); data/pscan-1.2/test.c:130:1: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(LOG_DEBUG, s); data/pscan-1.2/test.c:136:16: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. void *foo[] = {snprintf, fprintf}; /* OK */ data/pscan-1.2/test.c:136:26: [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 *foo[] = {snprintf, fprintf}; /* OK */ data/pscan-1.2/test.c:146:1: [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[1] = 1; /* OK */ data/pscan-1.2/pscan.c:200:20: [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 ((argval = getopt(argc, argv, "hp:vw")) != EOF) { data/pscan-1.2/pscan.c:116:3: [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 buffer[1024]; data/pscan-1.2/pscan.c:117:3: [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 name[1024]; data/pscan-1.2/pscan.c:125: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(file, "r"); data/pscan-1.2/pscan.c:253: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). if ((yyin = fopen(filename, "r")) == NULL) { data/pscan-1.2/test.c:54:1: [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(buffer, "string"); /* OK */ data/pscan-1.2/test.c:77:1: [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(buffer, "%d", sprintf(buffer1, variable)); /* problematic! */ ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 679 in approximately 0.05 seconds (13953 lines/second) Physical Source Lines of Code (SLOC) = 310 Hits@level = [0] 24 [1] 0 [2] 6 [3] 1 [4] 17 [5] 0 Hits@level+ = [0+] 48 [1+] 24 [2+] 24 [3+] 18 [4+] 17 [5+] 0 Hits/KSLOC@level+ = [0+] 154.839 [1+] 77.4194 [2+] 77.4194 [3+] 58.0645 [4+] 54.8387 [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.