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/libusbauth-configparser-1.0.2/src/generic.h Examining data/libusbauth-configparser-1.0.2/src/usbauth-configparser.h Examining data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c FINAL RESULTS: data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:201: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(arr, source, length * sizeof(struct Auth)); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:207:4: [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(arr->attr_array, source->attr_array, arr->attr_len * sizeof(struct Data)); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:213:4: [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(arr->cond_array, source->cond_array, arr->cond_len * sizeof(struct Data)); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:233: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). usbauth_yyin = fopen(CONFIG_FILE, "r"); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:248: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). FILE* fout = fopen(CONFIG_FILE, "w"); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:139:2: [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. strcpy(str, ""); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:140:2: [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. strcpy(v, ""); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:143:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(str, "condition", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:143:57: [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). strncat(str, "condition", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:145:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(str, "allow", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:145:53: [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). strncat(str, "allow", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:147:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(str, "deny", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:147:52: [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). strncat(str, "deny", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:153:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(str, " ", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:153:50: [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). strncat(str, " ", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:154:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, parameter_strings[cond_array[k].param], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:154:85: [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). strncat(str, parameter_strings[cond_array[k].param], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:155:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, operator_strings[cond_array[k].op], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:155:81: [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). strncat(str, operator_strings[cond_array[k].op], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:157:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, v, usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:157:48: [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). strncat(str, v, usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:160:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(str, " case", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:160:53: [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). strncat(str, " case", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:166:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(str, " ", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:166:49: [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). strncat(str, " ", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:167:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, attr_array[j].anyChild ? "anyChild " : "", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:167:87: [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). strncat(str, attr_array[j].anyChild ? "anyChild " : "", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:168:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, parameter_strings[attr_array[j].param], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:168:84: [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). strncat(str, parameter_strings[attr_array[j].param], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:169:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, operator_strings[attr_array[j].op], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:169:80: [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). strncat(str, operator_strings[attr_array[j].op], usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:171:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, v, usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:171: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). strncat(str, v, usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:175:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(str, " all", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:175:52: [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). strncat(str, " all", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:179:4: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(str, " ", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:179:50: [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). strncat(str, " ", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:180:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(str, "#", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:180:49: [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). strncat(str, "#", usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:181:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(str, auth->comment, usbauth_sub_length(str_len, strlen(str))); data/libusbauth-configparser-1.0.2/src/usbauth-configparser.c:181:59: [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). strncat(str, auth->comment, usbauth_sub_length(str_len, strlen(str))); ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 563 in approximately 0.04 seconds (15307 lines/second) Physical Source Lines of Code (SLOC) = 254 Hits@level = [0] 3 [1] 36 [2] 5 [3] 0 [4] 0 [5] 0 Hits@level+ = [0+] 44 [1+] 41 [2+] 5 [3+] 0 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 173.228 [1+] 161.417 [2+] 19.685 [3+] 0 [4+] 0 [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.