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/gfarm2fs-1.2.13/xattr.c Examining data/gfarm2fs-1.2.13/gfarm2fs.h Examining data/gfarm2fs-1.2.13/gfarm2fs_msg_enums.h Examining data/gfarm2fs-1.2.13/gfarm_config.c Examining data/gfarm2fs-1.2.13/open_file.c Examining data/gfarm2fs-1.2.13/open_file.h Examining data/gfarm2fs-1.2.13/gfarm_config.h Examining data/gfarm2fs-1.2.13/id.h Examining data/gfarm2fs-1.2.13/acl.c Examining data/gfarm2fs-1.2.13/acl.h Examining data/gfarm2fs-1.2.13/xattr.h Examining data/gfarm2fs-1.2.13/replicate.c Examining data/gfarm2fs-1.2.13/gfarm2fs_fix_acl.c Examining data/gfarm2fs-1.2.13/id.c Examining data/gfarm2fs-1.2.13/hash.h Examining data/gfarm2fs-1.2.13/replicate.h Examining data/gfarm2fs-1.2.13/gfarm2fs.c FINAL RESULTS: data/gfarm2fs-1.2.13/gfarm2fs_fix_acl.c:135:10: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. res = chmod(path, mode); data/gfarm2fs-1.2.13/gfarm2fs.c:192:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(gfarm2fs_realpath_prefix, "%s/%s", data/gfarm2fs-1.2.13/gfarm2fs.c:203:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(gfarm2fs_path_prefix, "%s/%s", data/gfarm2fs-1.2.13/gfarm2fs.c:296:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(p, "%s%s%s", gfarm2fs_path_prefix, data/gfarm2fs-1.2.13/gfarm2fs.c:348:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(gfarmized_old->path, "%s//%s", data/gfarm2fs-1.2.13/gfarm2fs.c:361:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(gfarmized_old->path, "%s//%s", data/gfarm2fs-1.2.13/gfarm_config.c:73:11: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. status = system(cmd); data/gfarm2fs-1.2.13/gfarm2fs.c:173:6: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. if (realpath(mpoint, buf) == NULL) { data/gfarm2fs-1.2.13/gfarm2fs_fix_acl.c:210: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, "crh?")) != -1) { data/gfarm2fs-1.2.13/acl.c:36: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(buf + nowlen, src, size); \ data/gfarm2fs-1.2.13/acl.c:285: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(value, posix, size); data/gfarm2fs-1.2.13/gfarm2fs.c:169: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/gfarm2fs-1.2.13/gfarm2fs.c:697: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(buf, old, len); data/gfarm2fs-1.2.13/gfarm2fs.c:1121:24: [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. gfarm2fs_utimens(const char *path, const struct timespec ts[2]) data/gfarm2fs-1.2.13/gfarm2fs.c:1788:31: [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. gfarm2fs_utimens_cached(const char *path, const struct timespec ts[2]) data/gfarm2fs-1.2.13/gfarm_config.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 line[XATTR_MAX]; data/gfarm2fs-1.2.13/gfarm_config.c:66:11: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int fd = mkstemp(filename), status, i, err = 0; data/gfarm2fs-1.2.13/gfarm_config.c:80: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(filename, O_RDONLY); data/gfarm2fs-1.2.13/replicate.c:133: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 *p, *n, *ep, s_ncopy[GFARM_INT32STRLEN]; data/gfarm2fs-1.2.13/xattr.c:212: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(dst, src, len); data/gfarm2fs-1.2.13/xattr.c:267: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(value, path, path_len); data/gfarm2fs-1.2.13/gfarm2fs.c:89:22: [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 path_len = strlen(gfarm_path); \ data/gfarm2fs-1.2.13/gfarm2fs.c:184:7: [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). strlen(buf) + 1 + GFARM_PATH_PREFIX_LEN; data/gfarm2fs-1.2.13/gfarm2fs.c:196: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). strlen(mpoint) + 1 + GFARM_PATH_PREFIX_LEN; data/gfarm2fs-1.2.13/gfarm2fs.c:224:24: [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). gfarm2fs_subdir_len = strlen(gfarm2fs_subdir); data/gfarm2fs-1.2.13/gfarm2fs.c:242: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). sz = strlen(p) data/gfarm2fs-1.2.13/gfarm2fs.c:291:7: [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). strlen(path) - (GFARM_URL_PREFIX_LENGTH + 2) + 1); data/gfarm2fs-1.2.13/gfarm2fs.c:345:7: [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). strlen(old) - gfarm2fs_path_prefix_len + 1); data/gfarm2fs-1.2.13/gfarm2fs.c:358:7: [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). strlen(old) - gfarm2fs_realpath_prefix_len + 1); data/gfarm2fs-1.2.13/gfarm2fs.c:694: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(old); data/gfarm2fs-1.2.13/gfarm2fs.c:2130:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0); data/gfarm2fs-1.2.13/gfarm_config.c:85:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size = read(fd, line, sizeof line); data/gfarm2fs-1.2.13/xattr.c:210: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(src); data/gfarm2fs-1.2.13/xattr.c:257: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). metadb_len = strlen(metadb); data/gfarm2fs-1.2.13/xattr.c:259: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). path_len = strlen(path); data/gfarm2fs-1.2.13/xattr.c:288: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). metadb_len = strlen(metadb); data/gfarm2fs-1.2.13/xattr.c:352:21: [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 = c->len + 2 + strlen(c->type) + 2 + port_size(c->flags); data/gfarm2fs-1.2.13/xattr.c:415: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(local_xattr[i].attr); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 4688 in approximately 0.15 seconds (31626 lines/second) Physical Source Lines of Code (SLOC) = 4013 Hits@level = [0] 34 [1] 17 [2] 12 [3] 2 [4] 6 [5] 1 Hits@level+ = [0+] 72 [1+] 38 [2+] 21 [3+] 9 [4+] 7 [5+] 1 Hits/KSLOC@level+ = [0+] 17.9417 [1+] 9.46923 [2+] 5.23299 [3+] 2.24271 [4+] 1.74433 [5+] 0.24919 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.