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/oflib-0git20070620/example/example.c Examining data/oflib-0git20070620/example/ramtest.c Examining data/oflib-0git20070620/example/soundbus.c Examining data/oflib-0git20070620/lib/of_internals.c Examining data/oflib-0git20070620/lib/of_internals.h Examining data/oflib-0git20070620/lib/of_standard.c Examining data/oflib-0git20070620/lib/of_standard.h Examining data/oflib-0git20070620/lib/of_api.h Examining data/oflib-0git20070620/lib/of_externals.c Examining data/oflib-0git20070620/lib/of_externals.h FINAL RESULTS: data/oflib-0git20070620/lib/of_externals.c:54:2: [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). strcat(strcat(buf, node->full_path), name); data/oflib-0git20070620/lib/of_externals.c:54:9: [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). strcat(strcat(buf, node->full_path), name); data/oflib-0git20070620/lib/of_externals.c:71:2: [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). strcat(strcat(buf, node->full_path), name); data/oflib-0git20070620/lib/of_externals.c:71:9: [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). strcat(strcat(buf, node->full_path), name); data/oflib-0git20070620/lib/of_internals.c:131:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s", p); data/oflib-0git20070620/lib/of_internals.c:348:5: [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). strcat(strcpy(fullpath, "/"), tmp->d_name); data/oflib-0git20070620/lib/of_internals.c:350:5: [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). strcat(strcat(strcpy(fullpath, path), "/"), data/oflib-0git20070620/lib/of_internals.c:350:19: [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). strcat(strcat(strcpy(fullpath, path), "/"), data/oflib-0git20070620/lib/of_externals.c:52: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 buf[PATH_MAX]={0}; data/oflib-0git20070620/lib/of_externals.c:64: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 buf[PATH_MAX]={0}; data/oflib-0git20070620/lib/of_externals.c:82:12: [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 ((fd = open(buf, O_RDONLY)) < 0) data/oflib-0git20070620/lib/of_externals.c:208: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 buf[PATH_MAX]; data/oflib-0git20070620/lib/of_internals.c:32: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 buf[PATH_MAX]; data/oflib-0git20070620/lib/of_internals.c:43:12: [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 ((fd = open(buf, O_RDONLY)) < 0) data/oflib-0git20070620/lib/of_internals.c:69: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 buf[PATH_MAX]; data/oflib-0git20070620/lib/of_internals.c:80:12: [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 ((fd = open(buf, O_RDONLY)) < 0) data/oflib-0git20070620/lib/of_internals.c: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 buf[PATH_MAX]; data/oflib-0git20070620/lib/of_internals.c:109:12: [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 ((fd = open(buf, O_RDONLY)) < 0) data/oflib-0git20070620/lib/of_internals.c:164: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 buf[PATH_MAX]; data/oflib-0git20070620/lib/of_internals.c:179:12: [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 ((fd = open(path, O_RDONLY)) < 0) data/oflib-0git20070620/lib/of_internals.c:270:12: [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 ((fd = open(path, O_RDONLY)) < 0) data/oflib-0git20070620/lib/of_internals.c:296: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 buf[PATH_MAX]; data/oflib-0git20070620/lib/of_internals.c:307:12: [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 ((fd = open(path, O_RDONLY)) < 0) data/oflib-0git20070620/lib/of_internals.c:329: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 *directories[8192] = { NULL }; data/oflib-0git20070620/lib/of_internals.c:330: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 fullpath[PATH_MAX]; data/oflib-0git20070620/lib/of_externals.c:38:8: [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). len = strlen(path); data/oflib-0git20070620/lib/of_externals.c:85:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((*plen = read(fd, property, size)) != size) data/oflib-0git20070620/lib/of_externals.c:153:34: [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). if((!node->path) || (!node) || (strlen(node->path)==1)) data/oflib-0git20070620/lib/of_internals.c:58:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, tmp, size) != size) data/oflib-0git20070620/lib/of_internals.c:87:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, node->type, size) != size) data/oflib-0git20070620/lib/of_internals.c:115:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, node->linux_phandle.data, size) != size) data/oflib-0git20070620/lib/of_internals.c:127:6: [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). i = strlen(OF_ROOT); data/oflib-0git20070620/lib/of_internals.c:182:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, buf, size) != size) data/oflib-0git20070620/lib/of_internals.c:227:16: [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 slen = strlen(path); data/oflib-0git20070620/lib/of_internals.c:233:6: [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). if(!strlen(path)) { data/oflib-0git20070620/lib/of_internals.c:273:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, props.data, size) != size) data/oflib-0git20070620/lib/of_internals.c:310:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(fd, buf, size) != size) data/oflib-0git20070620/lib/of_internals.c:348:12: [1] (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). Risk is low because the source is a constant character. strcat(strcpy(fullpath, "/"), tmp->d_name); data/oflib-0git20070620/lib/of_internals.c:350:12: [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. strcat(strcat(strcpy(fullpath, path), "/"), ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 1081 in approximately 0.05 seconds (23631 lines/second) Physical Source Lines of Code (SLOC) = 761 Hits@level = [0] 25 [1] 14 [2] 17 [3] 0 [4] 8 [5] 0 Hits@level+ = [0+] 64 [1+] 39 [2+] 25 [3+] 8 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 84.0999 [1+] 51.2484 [2+] 32.8515 [3+] 10.5125 [4+] 10.5125 [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.