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/acl-2.2.53/tools/chacl.c Examining data/acl-2.2.53/tools/parse.h Examining data/acl-2.2.53/tools/do_set.h Examining data/acl-2.2.53/tools/sequence.h Examining data/acl-2.2.53/tools/user_group.h Examining data/acl-2.2.53/tools/do_set.c Examining data/acl-2.2.53/tools/parse.c Examining data/acl-2.2.53/tools/sequence.c Examining data/acl-2.2.53/tools/setfacl.c Examining data/acl-2.2.53/tools/user_group.c Examining data/acl-2.2.53/tools/getfacl.c Examining data/acl-2.2.53/include/acl.h Examining data/acl-2.2.53/include/libacl.h Examining data/acl-2.2.53/include/misc.h Examining data/acl-2.2.53/include/walk_tree.h Examining data/acl-2.2.53/include/acl_ea.h Examining data/acl-2.2.53/examples/copy-acl.c Examining data/acl-2.2.53/examples/copyperm.c Examining data/acl-2.2.53/examples/get-acl.c Examining data/acl-2.2.53/examples/set-acl.c Examining data/acl-2.2.53/libmisc/walk_tree.c Examining data/acl-2.2.53/libmisc/next_line.c Examining data/acl-2.2.53/libmisc/high_water_alloc.c Examining data/acl-2.2.53/libmisc/quote.c Examining data/acl-2.2.53/libmisc/unquote.c Examining data/acl-2.2.53/test/test_group.c Examining data/acl-2.2.53/test/test_passwd.c Examining data/acl-2.2.53/libacl/__acl_from_xattr.h Examining data/acl-2.2.53/libacl/perm_copy_fd.c Examining data/acl-2.2.53/libacl/__acl_extended_file.h Examining data/acl-2.2.53/libacl/perm_copy.h Examining data/acl-2.2.53/libacl/byteorder.h Examining data/acl-2.2.53/libacl/__acl_to_xattr.h Examining data/acl-2.2.53/libacl/libobj.h Examining data/acl-2.2.53/libacl/perm_copy_file.c Examining data/acl-2.2.53/libacl/libacl.h Examining data/acl-2.2.53/libacl/__acl_extended_file.c Examining data/acl-2.2.53/libacl/__acl_from_xattr.c Examining data/acl-2.2.53/libacl/__acl_reorder_obj_p.c Examining data/acl-2.2.53/libacl/__acl_to_any_text.c Examining data/acl-2.2.53/libacl/__acl_to_xattr.c Examining data/acl-2.2.53/libacl/__apply_mask_to_mode.c Examining data/acl-2.2.53/libacl/__libobj.c Examining data/acl-2.2.53/libacl/acl_add_perm.c Examining data/acl-2.2.53/libacl/acl_calc_mask.c Examining data/acl-2.2.53/libacl/acl_check.c Examining data/acl-2.2.53/libacl/acl_clear_perms.c Examining data/acl-2.2.53/libacl/acl_cmp.c Examining data/acl-2.2.53/libacl/acl_copy_entry.c Examining data/acl-2.2.53/libacl/acl_copy_ext.c Examining data/acl-2.2.53/libacl/acl_copy_int.c Examining data/acl-2.2.53/libacl/acl_create_entry.c Examining data/acl-2.2.53/libacl/acl_delete_def_file.c Examining data/acl-2.2.53/libacl/acl_delete_entry.c Examining data/acl-2.2.53/libacl/acl_delete_perm.c Examining data/acl-2.2.53/libacl/acl_dup.c Examining data/acl-2.2.53/libacl/acl_entries.c Examining data/acl-2.2.53/libacl/acl_equiv_mode.c Examining data/acl-2.2.53/libacl/acl_error.c Examining data/acl-2.2.53/libacl/acl_extended_fd.c Examining data/acl-2.2.53/libacl/acl_extended_file.c Examining data/acl-2.2.53/libacl/acl_extended_file_nofollow.c Examining data/acl-2.2.53/libacl/acl_free.c Examining data/acl-2.2.53/libacl/acl_from_mode.c Examining data/acl-2.2.53/libacl/acl_from_text.c Examining data/acl-2.2.53/libacl/acl_get_entry.c Examining data/acl-2.2.53/libacl/acl_get_fd.c Examining data/acl-2.2.53/libacl/acl_get_file.c Examining data/acl-2.2.53/libacl/acl_get_perm.c Examining data/acl-2.2.53/libacl/acl_get_permset.c Examining data/acl-2.2.53/libacl/acl_get_qualifier.c Examining data/acl-2.2.53/libacl/acl_get_tag_type.c Examining data/acl-2.2.53/libacl/acl_init.c Examining data/acl-2.2.53/libacl/acl_set_fd.c Examining data/acl-2.2.53/libacl/acl_set_file.c Examining data/acl-2.2.53/libacl/acl_set_permset.c Examining data/acl-2.2.53/libacl/acl_set_qualifier.c Examining data/acl-2.2.53/libacl/acl_set_tag_type.c Examining data/acl-2.2.53/libacl/acl_size.c Examining data/acl-2.2.53/libacl/acl_to_any_text.c Examining data/acl-2.2.53/libacl/acl_to_text.c Examining data/acl-2.2.53/libacl/acl_valid.c FINAL RESULTS: data/acl-2.2.53/libacl/perm_copy_file.c:147:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = chmod (path, mode); data/acl-2.2.53/libacl/perm_copy_file.c:194:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = chmod (dst_path, st.st_mode); data/acl-2.2.53/libacl/perm_copy_file.c:232:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. ret = chmod (dst_path, st.st_mode); data/acl-2.2.53/tools/do_set.c:487:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(path_p, mode) != 0) data/acl-2.2.53/tools/setfacl.c:204:8: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. if (chown(path_p, st.st_uid, st.st_gid) != 0) { data/acl-2.2.53/tools/setfacl.c:223:8: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. if (chmod(path_p, flags | args.mode) != 0) { data/acl-2.2.53/examples/copyperm.c:35:6: [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. if (vfprintf(stderr, fmt, ap)) data/acl-2.2.53/libacl/__acl_to_any_text.c:90:3: [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). strcpy(string_obj_p->sstr + len, suffix); data/acl-2.2.53/libmisc/walk_tree.c:182:4: [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). strcpy(path_end, entry->d_name); data/acl-2.2.53/libmisc/walk_tree.c:230:2: [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). strcpy(path_copy, path); data/acl-2.2.53/tools/chacl.c:346:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(name, "%s/%s", fname, d->d_name); data/acl-2.2.53/tools/getfacl.c:173:3: [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). strcpy(last->name, name); data/acl-2.2.53/tools/parse.c:470:5: [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). strcpy(*path_p, cp); data/acl-2.2.53/tools/chacl.c:85:14: [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. while ((c = getopt(argc, argv, "bdlRDBr")) != -1) { data/acl-2.2.53/tools/getfacl.c:611:6: [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. if (getenv(POSIXLY_CORRECT_STR)) data/acl-2.2.53/tools/getfacl.c:628:16: [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, cmd_line_options, data/acl-2.2.53/tools/setfacl.c:349:6: [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. if (getenv(POSIXLY_CORRECT_STR)) data/acl-2.2.53/tools/setfacl.c:369:16: [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, cmd_line_options, data/acl-2.2.53/libacl/acl_from_text.c:119: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(token, *text_p, (ep - *text_p)); data/acl-2.2.53/libacl/libobj.h:80: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 s_str[0]; data/acl-2.2.53/libmisc/walk_tree.c:215: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_copy[FILENAME_MAX]; data/acl-2.2.53/test/test_group.c:85:9: [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 = fopen(grfile, "r"); data/acl-2.2.53/test/test_group.c:125: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. static char buf[16384]; data/acl-2.2.53/test/test_group.c:149: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. static char buf[16384]; data/acl-2.2.53/test/test_passwd.c:78:9: [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 = fopen(pwfile, "r"); data/acl-2.2.53/test/test_passwd.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. static char buf[16384]; data/acl-2.2.53/test/test_passwd.c:143: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. static char buf[16384]; data/acl-2.2.53/tools/getfacl.c:102: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 name[0]; data/acl-2.2.53/tools/getfacl.c:261: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 acl_perm[ACL_PERMS+1], dacl_perm[ACL_PERMS+1]; data/acl-2.2.53/tools/getfacl.c:339: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 acl_mask[ACL_PERMS+1], dacl_mask[ACL_PERMS+1]; data/acl-2.2.53/tools/getfacl.c:439: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. static char str[4]; data/acl-2.2.53/tools/parse.c:97: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(token, bp, ep - bp); data/acl-2.2.53/tools/setfacl.c:508:13: [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 = fopen(optarg, "r"); data/acl-2.2.53/tools/setfacl.c:567:13: [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 = fopen(optarg, "r"); data/acl-2.2.53/tools/user_group.c:34: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. static char uid_str[22]; data/acl-2.2.53/tools/user_group.c:50: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. static char gid_str[22]; data/acl-2.2.53/libacl/__acl_to_any_text.c:44:25: [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). suffix_len = suffix ? strlen(suffix) : 0; data/acl-2.2.53/libacl/__acl_to_any_text.c:118:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text_p, (s), size); \ data/acl-2.2.53/libacl/__acl_to_any_text.c:147:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text_p, prefix, size); data/acl-2.2.53/libacl/__acl_to_any_text.c:148:11: [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). ADVANCE(strlen(prefix)); data/acl-2.2.53/libacl/__acl_to_any_text.c:165:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text_p, str, size); data/acl-2.2.53/libacl/__acl_to_any_text.c:166:14: [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). ADVANCE(strlen(str)); data/acl-2.2.53/libacl/__acl_to_any_text.c:188:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text_p, str, size); data/acl-2.2.53/libacl/__acl_to_any_text.c:189:14: [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). ADVANCE(strlen(str)); data/acl-2.2.53/libacl/__acl_to_any_text.c:255:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text_p, tabs+x, size); data/acl-2.2.53/libacl/__acl_to_any_text.c:258:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text_p, EFFECTIVE_STR, size); data/acl-2.2.53/libacl/acl_from_text.c:80: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). size_t len = strlen(token); data/acl-2.2.53/libmisc/walk_tree.c:174:28: [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 ((path_end - path) + strlen(entry->d_name) + 1 >= data/acl-2.2.53/libmisc/walk_tree.c:226: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) >= FILENAME_MAX) { data/acl-2.2.53/test/test_group.c:32:30: [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). remain = buf + ALIGN(line + strlen(line) - buf, sizeof(char *)); data/acl-2.2.53/tools/chacl.c:340:17: [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). name = malloc(strlen(fname) + strlen(d->d_name) + 2); data/acl-2.2.53/tools/chacl.c:340:33: [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). name = malloc(strlen(fname) + strlen(d->d_name) + 2); data/acl-2.2.53/tools/getfacl.c:159:9: [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(name); data/acl-2.2.53/tools/getfacl.c:185:13: [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). int len = strlen(names->name); data/acl-2.2.53/tools/parse.c:51: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). size_t len = strlen(token); data/acl-2.2.53/tools/parse.c:429:7: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = fgetc(file); data/acl-2.2.53/tools/parse.c:467:29: [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). *path_p = (char*)malloc(strlen(cp)+1); data/acl-2.2.53/tools/setfacl.c:450:28: [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) which >= strlen(optarg)) { ANALYSIS SUMMARY: Hits = 58 Lines analyzed = 8735 in approximately 0.28 seconds (31212 lines/second) Physical Source Lines of Code (SLOC) = 5867 Hits@level = [0] 102 [1] 22 [2] 18 [3] 5 [4] 7 [5] 6 Hits@level+ = [0+] 160 [1+] 58 [2+] 36 [3+] 18 [4+] 13 [5+] 6 Hits/KSLOC@level+ = [0+] 27.2712 [1+] 9.8858 [2+] 6.13601 [3+] 3.06801 [4+] 2.21578 [5+] 1.02267 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.