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/smem-1.5/smemcap.c FINAL RESULTS: data/smem-1.5/smemcap.c:34:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(header, "%s", path); data/smem-1.5/smemcap.c:88:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/%s", sub, name); data/smem-1.5/smemcap.c:22: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 data[512]; data/smem-1.5/smemcap.c:29: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 header[512]; data/smem-1.5/smemcap.c:35:2: [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(header + 100, "%07o", mode & 0777); data/smem-1.5/smemcap.c:36:2: [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(header + 108, "%07o", uid); data/smem-1.5/smemcap.c:37:2: [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(header + 116, "%07o", gid); data/smem-1.5/smemcap.c:38:2: [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(header + 124, "%011o", size); data/smem-1.5/smemcap.c:39:2: [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(header + 136, "%07o", mtime); data/smem-1.5/smemcap.c:40:2: [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(header + 148, " %1d", type); data/smem-1.5/smemcap.c:45:2: [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(header + 148, "%06o", sum); data/smem-1.5/smemcap.c:58:7: [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(path, O_RDONLY); data/smem-1.5/smemcap.c: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 path[256]; data/smem-1.5/smemcap.c:65:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, cur->data, 512); ANALYSIS SUMMARY: Hits = 14 Lines analyzed = 114 in approximately 0.01 seconds (8497 lines/second) Physical Source Lines of Code (SLOC) = 83 Hits@level = [0] 0 [1] 1 [2] 11 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 14 [1+] 14 [2+] 13 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 168.675 [1+] 168.675 [2+] 156.627 [3+] 24.0964 [4+] 24.0964 [5+] 0 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.