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/loadlin-1.6f/src/srclinux/pgadjust.c Examining data/loadlin-1.6f/initrd/linuxrc.c Examining data/loadlin-1.6f/initrd/freeramdisk.c FINAL RESULTS: data/loadlin-1.6f/initrd/freeramdisk.c:17:16: [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). if (argv[1]) strcpy(rname,argv[1]); data/loadlin-1.6f/initrd/freeramdisk.c:21:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(b,"freeramdisk: cannot umount %s %d",rname,errno); data/loadlin-1.6f/initrd/freeramdisk.c:28:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(b,"freeramdisk: cannot open %s",rname); data/loadlin-1.6f/initrd/linuxrc.c:27:15: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. real_root = getenv("real_root"); data/loadlin-1.6f/initrd/freeramdisk.c:14: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 rname[256]="/dev/ram"; data/loadlin-1.6f/initrd/freeramdisk.c:15: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 b[256]; data/loadlin-1.6f/initrd/freeramdisk.c:27:10: [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 ((f=open(rname,O_RDWR)) == -1) { data/loadlin-1.6f/initrd/linuxrc.c:31:14: [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 (! (f=fopen("/proc/sys/kernel/real-root-dev","w"))) return 0; data/loadlin-1.6f/src/srclinux/pgadjust.c:23:11: [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. unsigned char unused1[2]; data/loadlin-1.6f/src/srclinux/pgadjust.c:120:15: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. static void * memcpy(void * __dest, void * __src, data/loadlin-1.6f/src/srclinux/pgadjust.c:131:2: [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 ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 ); data/loadlin-1.6f/src/srclinux/pgadjust.c:175:15: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. static void * memcpy(void * __dest, void * __src, data/loadlin-1.6f/src/srclinux/pgadjust.c:187:10: [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 table[17]="0123456789ABCDEF"; data/loadlin-1.6f/src/srclinux/pgadjust.c:188: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 b[9]; data/loadlin-1.6f/src/srclinux/pgadjust.c:216: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(t,s,4096); data/loadlin-1.6f/src/srclinux/pgadjust.c:348:5: [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). f=fopen(fname, "r"); ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 507 in approximately 0.03 seconds (15258 lines/second) Physical Source Lines of Code (SLOC) = 401 Hits@level = [0] 8 [1] 0 [2] 12 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 24 [1+] 16 [2+] 16 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 59.8504 [1+] 39.9002 [2+] 39.9002 [3+] 9.97506 [4+] 7.4813 [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.