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/hardlink-0.3.2/configure.c Examining data/hardlink-0.3.2/hardlink.c FINAL RESULTS: data/hardlink-0.3.2/hardlink.c:217:24: [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. __attribute__ ((format(printf, 2, 3))) data/hardlink-0.3.2/hardlink.c:235: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. vfprintf(stream, format, args); data/hardlink-0.3.2/configure.c:43:12: [3] (buffer) getopt_long: 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. return getopt_long(argc, argv, "", options, 0); data/hardlink-0.3.2/hardlink.c:68:9: [3] (buffer) getopt_long: 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. #define getopt_long(argc, argv, shrt, lng, index) getopt((argc), (argv), (shrt)) data/hardlink-0.3.2/hardlink.c:68:51: [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. #define getopt_long(argc, argv, shrt, lng, index) getopt((argc), (argv), (shrt)) data/hardlink-0.3.2/hardlink.c:1069:19: [3] (buffer) getopt_long: 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 ((opt = getopt_long(argc, argv, optstr, long_options, NULL)) != -1) { data/hardlink-0.3.2/hardlink.c:117: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. char path[0]; data/hardlink-0.3.2/hardlink.c:119: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. char path[1]; data/hardlink-0.3.2/hardlink.c:262: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[256]; data/hardlink-0.3.2/hardlink.c:610:5: [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_a[8192]; data/hardlink-0.3.2/hardlink.c:611:5: [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_b[8192]; data/hardlink-0.3.2/hardlink.c:622:15: [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 ((fa = fopen(a->links->path, "rb")) == NULL) data/hardlink-0.3.2/hardlink.c:624:15: [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 ((fb = fopen(b->links->path, "rb")) == NULL) data/hardlink-0.3.2/hardlink.c:850:5: [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(fil->links->path, fpath, pathlen); data/hardlink-0.3.2/hardlink.c:456:54: [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 (name = names; name < (names + len); name += strlen(name) + 1) data/hardlink-0.3.2/hardlink.c:485:18: [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). names += strlen(names) + 1; data/hardlink-0.3.2/hardlink.c:742:22: [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). size_t len = strlen(b->links->path) + strlen(".hardlink-temporary") + 1; data/hardlink-0.3.2/hardlink.c:742:47: [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). size_t len = strlen(b->links->path) + strlen(".hardlink-temporary") + 1; data/hardlink-0.3.2/hardlink.c:834:15: [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). pathlen = strlen(fpath) + 1; ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 1301 in approximately 0.07 seconds (19713 lines/second) Physical Source Lines of Code (SLOC) = 821 Hits@level = [0] 14 [1] 5 [2] 8 [3] 4 [4] 2 [5] 0 Hits@level+ = [0+] 33 [1+] 19 [2+] 14 [3+] 6 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 40.1949 [1+] 23.1425 [2+] 17.0524 [3+] 7.30816 [4+] 2.43605 [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.