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/libhugetlbfs-2.23/alloc.c
Examining data/libhugetlbfs-2.23/debug.c
Examining data/libhugetlbfs-2.23/elf32ppclinux.c
Examining data/libhugetlbfs-2.23/elf64ppc.c
Examining data/libhugetlbfs-2.23/elflink.c
Examining data/libhugetlbfs-2.23/hugeadm.c
Examining data/libhugetlbfs-2.23/hugectl.c
Examining data/libhugetlbfs-2.23/hugeedit.c
Examining data/libhugetlbfs-2.23/hugetlbfs.h
Examining data/libhugetlbfs-2.23/hugeutils.c
Examining data/libhugetlbfs-2.23/init.c
Examining data/libhugetlbfs-2.23/init_privutils.c
Examining data/libhugetlbfs-2.23/kernel-features.c
Examining data/libhugetlbfs-2.23/kernel-features.h
Examining data/libhugetlbfs-2.23/libhugetlbfs_debug.h
Examining data/libhugetlbfs-2.23/libhugetlbfs_internal.h
Examining data/libhugetlbfs-2.23/libhugetlbfs_privutils.h
Examining data/libhugetlbfs-2.23/libhugetlbfs_testprobes.h
Examining data/libhugetlbfs-2.23/morecore.c
Examining data/libhugetlbfs-2.23/pagesize.c
Examining data/libhugetlbfs-2.23/shm.c
Examining data/libhugetlbfs-2.23/tests/alloc-instantiate-race.c
Examining data/libhugetlbfs-2.23/tests/brk_near_huge.c
Examining data/libhugetlbfs-2.23/tests/chunk-overcommit.c
Examining data/libhugetlbfs-2.23/tests/compare_kvers.c
Examining data/libhugetlbfs-2.23/tests/corrupt-by-cow-opt.c
Examining data/libhugetlbfs-2.23/tests/counters.c
Examining data/libhugetlbfs-2.23/tests/direct.c
Examining data/libhugetlbfs-2.23/tests/dummy.c
Examining data/libhugetlbfs-2.23/tests/empty_mounts.c
Examining data/libhugetlbfs-2.23/tests/fadvise_reserve.c
Examining data/libhugetlbfs-2.23/tests/fallocate_align.c
Examining data/libhugetlbfs-2.23/tests/fallocate_basic.c
Examining data/libhugetlbfs-2.23/tests/fallocate_stress.c
Examining data/libhugetlbfs-2.23/tests/find_path.c
Examining data/libhugetlbfs-2.23/tests/fork-cow.c
Examining data/libhugetlbfs-2.23/tests/get_huge_pages.c
Examining data/libhugetlbfs-2.23/tests/get_hugepage_region.c
Examining data/libhugetlbfs-2.23/tests/get_hugetlbfs_path.c
Examining data/libhugetlbfs-2.23/tests/gethugepagesize.c
Examining data/libhugetlbfs-2.23/tests/gethugepagesizes.c
Examining data/libhugetlbfs-2.23/tests/heap-overflow.c
Examining data/libhugetlbfs-2.23/tests/heapshrink-helper.c
Examining data/libhugetlbfs-2.23/tests/heapshrink.c
Examining data/libhugetlbfs-2.23/tests/huge_at_4GB_normal_below.c
Examining data/libhugetlbfs-2.23/tests/huge_below_4GB_normal_above.c
Examining data/libhugetlbfs-2.23/tests/hugetests.h
Examining data/libhugetlbfs-2.23/tests/icache-hygiene.c
Examining data/libhugetlbfs-2.23/tests/large_mounts.c
Examining data/libhugetlbfs-2.23/tests/libtestutils.c
Examining data/libhugetlbfs-2.23/tests/linkhuge.c
Examining data/libhugetlbfs-2.23/tests/linkhuge_nofd.c
Examining data/libhugetlbfs-2.23/tests/linkhuge_rw.c
Examining data/libhugetlbfs-2.23/tests/linkshare.c
Examining data/libhugetlbfs-2.23/tests/madvise_reserve.c
Examining data/libhugetlbfs-2.23/tests/malloc.c
Examining data/libhugetlbfs-2.23/tests/malloc_manysmall.c
Examining data/libhugetlbfs-2.23/tests/map_high_truncate_2.c
Examining data/libhugetlbfs-2.23/tests/meminfo_nohuge.c
Examining data/libhugetlbfs-2.23/tests/misalign.c
Examining data/libhugetlbfs-2.23/tests/misaligned_offset.c
Examining data/libhugetlbfs-2.23/tests/mlock.c
Examining data/libhugetlbfs-2.23/tests/mmap-cow.c
Examining data/libhugetlbfs-2.23/tests/mmap-gettest.c
Examining data/libhugetlbfs-2.23/tests/mprotect.c
Examining data/libhugetlbfs-2.23/tests/mremap-expand-slice-collision.c
Examining data/libhugetlbfs-2.23/tests/mremap-fixed-huge-near-normal.c
Examining data/libhugetlbfs-2.23/tests/mremap-fixed-normal-near-huge.c
Examining data/libhugetlbfs-2.23/tests/noresv-preserve-resv-page.c
Examining data/libhugetlbfs-2.23/tests/noresv-regarded-as-resv.c
Examining data/libhugetlbfs-2.23/tests/private.c
Examining data/libhugetlbfs-2.23/tests/ptrace-write-hugepage.c
Examining data/libhugetlbfs-2.23/tests/quota.c
Examining data/libhugetlbfs-2.23/tests/readahead_reserve.c
Examining data/libhugetlbfs-2.23/tests/readback.c
Examining data/libhugetlbfs-2.23/tests/shared.c
Examining data/libhugetlbfs-2.23/tests/shm-fork.c
Examining data/libhugetlbfs-2.23/tests/shm-getraw.c
Examining data/libhugetlbfs-2.23/tests/shm-gettest.c
Examining data/libhugetlbfs-2.23/tests/shm-perms.c
Examining data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c
Examining data/libhugetlbfs-2.23/tests/slbpacaflush.c
Examining data/libhugetlbfs-2.23/tests/stack_grow_into_huge.c
Examining data/libhugetlbfs-2.23/tests/straddle_4GB.c
Examining data/libhugetlbfs-2.23/tests/task-size-overrun.c
Examining data/libhugetlbfs-2.23/tests/test_root.c
Examining data/libhugetlbfs-2.23/tests/testutils.c
Examining data/libhugetlbfs-2.23/tests/truncate.c
Examining data/libhugetlbfs-2.23/tests/truncate_above_4GB.c
Examining data/libhugetlbfs-2.23/tests/truncate_reserve_wraparound.c
Examining data/libhugetlbfs-2.23/tests/truncate_sigbus_versus_oom.c
Examining data/libhugetlbfs-2.23/tests/unlinked_fd.c
Examining data/libhugetlbfs-2.23/tests/zero_filesize_segment.c
Examining data/libhugetlbfs-2.23/version.c

FINAL RESULTS:

data/libhugetlbfs-2.23/elflink.c:356:8:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
	ret = readlink("/proc/self/exe", binary, PATH_MAX);
data/libhugetlbfs-2.23/hugeadm.c:454:7:  [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, uid, gid)) {
data/libhugetlbfs-2.23/hugeadm.c:460:7:  [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, mode)) {
data/libhugetlbfs-2.23/hugeadm.c:559:22:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
          useMtab = (readlink(MOUNTED, &dummy, 1) < 0);
data/libhugetlbfs-2.23/hugeadm.c:579:7:  [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, uid, gid)) {
data/libhugetlbfs-2.23/hugeadm.c:585:7:  [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, mode)) {
data/libhugetlbfs-2.23/hugeutils.c:1040:2:  [5] (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 high; the length parameter
  appears to be a constant, instead of computing the number of characters
  left.
	strncat(name, "/libhugetlbfs.tmp.XXXXXX", sizeof(name)-1);
data/libhugetlbfs-2.23/elflink.c:201:8:  [4] (format) vsnprintf:
  If format strings can be influenced by an attacker, they can be exploited,
  and note that sprintf variations do not always \0-terminate (CWE-134). Use
  a constant for the format specification.
	len = vsnprintf(dst, PATH_MAX+1, fmt, ap);
data/libhugetlbfs-2.23/hugeadm.c:55:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(stderr, "hugeadm:" prefix ": " format,       \
data/libhugetlbfs-2.23/hugeadm.c:343:2:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	printf(format_str, "Mount Point", "Options");
data/libhugetlbfs-2.23/hugeadm.c:345:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
		printf(format_str, current->entry.mnt_dir,
data/libhugetlbfs-2.23/hugeadm.c:708: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(options, limits);
data/libhugetlbfs-2.23/hugeadm.c:1026:8:  [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.
	ret = system(mkswap_cmd);
data/libhugetlbfs-2.23/hugeadm.c:1099:7:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
		if (access(ramdisk, F_OK) != 0){
data/libhugetlbfs-2.23/hugeadm.c:1112:10:  [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.
			ret = system(mkswap_cmd);
data/libhugetlbfs-2.23/hugeadm.c:1132:3:  [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(ramdisk_list, ramdisk);
data/libhugetlbfs-2.23/hugectl.c:43:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(stderr, "hugectl: " prefix ": " format,	      \
data/libhugetlbfs-2.23/hugectl.c:288:7:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
		if (access(val, F_OK) == 0) {
data/libhugetlbfs-2.23/hugectl.c:485:2:  [4] (shell) execvp:
  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.
	execvp(argv[index], &argv[index]);
data/libhugetlbfs-2.23/hugeedit.c:40:3:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
		fprintf(stderr, "hugeedit: " prefix ": " format, \
data/libhugetlbfs-2.23/hugeutils.c:497: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(filename, MEMINFO);
data/libhugetlbfs-2.23/hugeutils.c:500:4:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
			sprintf(filename, PROC_HUGEPAGES_DIR "%s", sysfs_file);
data/libhugetlbfs-2.23/hugeutils.c:502:3:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
		sprintf(filename, SYSFS_HUGEPAGES_DIR "hugepages-%lukB/%s",
data/libhugetlbfs-2.23/hugeutils.c:605: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(hpage_sizes[idx].mount, path);
data/libhugetlbfs-2.23/hugeutils.c:671:10:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
			    !(access(path, R_OK | W_OK | X_OK)))
data/libhugetlbfs-2.23/hugeutils.c:809:7:  [4] (shell) popen:
  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.
	fp = popen("cat /proc/cpuinfo | grep MMU | awk '{ print $3}'", "r");
data/libhugetlbfs-2.23/hugeutils.c:810:13:  [4] (buffer) fscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
	if (!fp || fscanf(fp, "%s", mmu_type) < 0) {
data/libhugetlbfs-2.23/hugeutils.c:1039: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(name, path);
data/libhugetlbfs-2.23/hugeutils.c:1129:6:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
	if (access(file, O_RDONLY))
data/libhugetlbfs-2.23/libhugetlbfs_internal.h:140:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(stderr, REPORT_UTIL); \
data/libhugetlbfs-2.23/libhugetlbfs_internal.h:144:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(stderr, ": " prefix ": " format, \
data/libhugetlbfs-2.23/libhugetlbfs_internal.h:153:4:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
			fprintf(stderr, ##__VA_ARGS__); \
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:106:4:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
			sprintf(fname, "%s/meminfo-hugepages", fake_meminfo);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:112:4:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
			sprintf(fname, "%s/meminfo-none", fake_meminfo);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:148:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(fname, "%s/meminfo-none", fake_meminfo);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:151:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(fname, "%s/meminfo-hugepages", fake_meminfo);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:225:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(fname, "%s/meminfo-none", fake_meminfo);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:235:2:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	sprintf(fname, "%s/meminfo-hugepages", fake_meminfo);
data/libhugetlbfs-2.23/tests/hugetests.h:71:3:  [4] (format) printf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
		printf(__VA_ARGS__); \
data/libhugetlbfs-2.23/tests/hugetests.h:75:29:  [4] (format) fprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
#define ERROR(fmt, args...)	fprintf(stderr, ERR fmt, ## args)
data/libhugetlbfs-2.23/tests/hugetests.h:147:7:  [4] (shell) popen:
  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.
	fp = popen("cat /proc/pagetypeinfo | "
data/libhugetlbfs-2.23/tests/linkshare.c:185:9:  [4] (shell) execlp:
  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.
		ret = execlp(self, self, execarg1, NULL);
data/libhugetlbfs-2.23/tests/meminfo_nohuge.c:44:7:  [4] (shell) popen:
  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.
		f = popen("/bin/grep -vi ^hugepage /proc/meminfo", "r");
data/libhugetlbfs-2.23/tests/meminfo_nohuge.c:51:7:  [4] (shell) popen:
  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.
		f = popen("/bin/grep -vi hugetlbfs /proc/mounts", "r");
data/libhugetlbfs-2.23/tests/quota.c:128:2:  [4] (shell) execlp:
  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.
	execlp(prog, prog, "-p", mount_str, NULL);
data/libhugetlbfs-2.23/tests/testutils.c:100:3:  [4] (format) sprintf:
  Potential format string problem (CWE-134). Make format string constant.
		sprintf(path_buf, SYSFS_CPU_ONLINE_FMT, i);
data/libhugetlbfs-2.23/tests/testutils.c:282:9:  [4] (buffer) sscanf:
  The scanf() family's %s operation, without a limit specification, permits
  buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a
  different input function.
		ret = sscanf(line, "%lx-%lx %s %lx %s %ld %s", &start, &end,
data/libhugetlbfs-2.23/hugeadm.c:211:8:  [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.
	env = getenv("HUGETLB_VERBOSE");
data/libhugetlbfs-2.23/hugeadm.c:214:8:  [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.
	env = getenv("HUGETLB_DEBUG");
data/libhugetlbfs-2.23/hugeadm.c:1486:9:  [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.
		ret = getopt_long(argc, argv, opts, long_opts, &index);
data/libhugetlbfs-2.23/hugectl.c:103:8:  [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.
	env = getenv("HUGETLB_VERBOSE");
data/libhugetlbfs-2.23/hugectl.c:106:8:  [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.
	env = getenv("HUGETLB_DEBUG");
data/libhugetlbfs-2.23/hugectl.c:277:8:  [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.
	env = getenv("LD_LIBRARY_PATH");
data/libhugetlbfs-2.23/hugectl.c:382:9:  [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.
		ret = getopt_long(argc, argv, opts, long_opts, &index);
data/libhugetlbfs-2.23/hugeedit.c:181:9:  [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.
		ret = getopt_long(argc, argv, opts, long_opts, &index);
data/libhugetlbfs-2.23/hugeutils.c:293:8:  [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.
	env = getenv("HUGETLB_VERBOSE");
data/libhugetlbfs-2.23/hugeutils.c:297:8:  [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.
	env = getenv("HUGETLB_DEBUG");
data/libhugetlbfs-2.23/hugeutils.c:303:8:  [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.
	env = getenv("HUGETLB_RESTRICT_EXE");
data/libhugetlbfs-2.23/hugeutils.c:326:8:  [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.
	env = getenv("HUGETLB_NO_PREFAULT");
data/libhugetlbfs-2.23/hugeutils.c:330:30:  [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.
	__hugetlb_opts.share_path = getenv("HUGETLB_SHARE_PATH");
data/libhugetlbfs-2.23/hugeutils.c:331:26:  [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.
	__hugetlb_opts.elfmap = getenv("HUGETLB_ELFMAP");
data/libhugetlbfs-2.23/hugeutils.c:332:30:  [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.
	__hugetlb_opts.ld_preload = getenv("LD_PRELOAD");
data/libhugetlbfs-2.23/hugeutils.c:333:33:  [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.
	__hugetlb_opts.def_page_size = getenv("HUGETLB_DEFAULT_PAGE_SIZE");
data/libhugetlbfs-2.23/hugeutils.c:334:24:  [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.
	__hugetlb_opts.path = getenv("HUGETLB_PATH");
data/libhugetlbfs-2.23/hugeutils.c:335:28:  [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.
	__hugetlb_opts.features = getenv("HUGETLB_FEATURES");
data/libhugetlbfs-2.23/hugeutils.c:336:28:  [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.
	__hugetlb_opts.morecore = getenv("HUGETLB_MORECORE");
data/libhugetlbfs-2.23/hugeutils.c:337:28:  [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.
	__hugetlb_opts.heapbase = getenv("HUGETLB_MORECORE_HEAPBASE");
data/libhugetlbfs-2.23/hugeutils.c:348:8:  [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.
	env = getenv("HUGETLB_FORCE_ELFMAP");
data/libhugetlbfs-2.23/hugeutils.c:352:8:  [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.
	env = getenv("HUGETLB_MINIMAL_COPY");
data/libhugetlbfs-2.23/hugeutils.c:359:8:  [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.
	env = getenv("HUGETLB_SHARE");
data/libhugetlbfs-2.23/hugeutils.c:378:8:  [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.
	env = getenv("HUGETLB_MORECORE_SHRINK");
data/libhugetlbfs-2.23/hugeutils.c:383:8:  [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.
	env = getenv("HUGETLB_SHM");
data/libhugetlbfs-2.23/hugeutils.c:388:8:  [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.
	env = getenv("HUGETLB_NO_RESERVE");
data/libhugetlbfs-2.23/pagesize.c:86:9:  [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.
		ret = getopt_long(argc, argv, opts, long_opts, &index);
data/libhugetlbfs-2.23/tests/fallocate_stress.c:57:23:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
		tpage = ((long long)random()) % (max_hpages);
data/libhugetlbfs-2.23/tests/fallocate_stress.c:98:23:  [3] (random) random:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
		tpage = ((long long)random()) % (max_hpages);
data/libhugetlbfs-2.23/tests/fallocate_stress.c:160:2:  [3] (random) srandom:
  This function is not sufficiently random for security-related functions
  such as key and nonce creation (CWE-327). Use a more secure technique for
  acquiring random values.
	srandom((int)getpid() * time(NULL));
data/libhugetlbfs-2.23/tests/heap-overflow.c:48:7:  [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("HUGETLB_MORECORE"))
data/libhugetlbfs-2.23/tests/heapshrink.c:43:13:  [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.
	have_env = getenv("HUGETLB_MORECORE") != NULL;
data/libhugetlbfs-2.23/tests/heapshrink.c:44:14:  [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.
	shrink_ok = getenv("HUGETLB_MORECORE_SHRINK") != NULL;
data/libhugetlbfs-2.23/tests/heapshrink.c:45: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.
	p = getenv("LD_PRELOAD");
data/libhugetlbfs-2.23/tests/heapshrink.c:62: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.
	p = getenv("GLIBC_TUNABLES");
data/libhugetlbfs-2.23/tests/linkhuge.c:138:8:  [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.
	env = getenv("HUGETLB_ELFMAP");
data/libhugetlbfs-2.23/tests/linkhuge_rw.c:234:8:  [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.
	env = getenv("HUGETLB_ELFMAP");
data/libhugetlbfs-2.23/tests/linkshare.c:154:8:  [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.
	env = getenv("HUGETLB_ELFMAP");
data/libhugetlbfs-2.23/tests/linkshare.c:159:9:  [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.
		env = getenv("HUGETLB_SHARE");
data/libhugetlbfs-2.23/tests/malloc.c:56:9:  [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.
	env1 = getenv("HUGETLB_MORECORE");
data/libhugetlbfs-2.23/tests/malloc.c:58:9:  [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.
	env2 = getenv("HUGETLB_RESTRICT_EXE");
data/libhugetlbfs-2.23/tests/malloc_manysmall.c:48:8:  [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.
	env = getenv("HUGETLB_MORECORE");
data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c:225:8:  [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.
	env = getenv("HUGETLB_SHM");
data/libhugetlbfs-2.23/tests/testutils.c:163: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("QUIET_TEST"))
data/libhugetlbfs-2.23/alloc.c:48: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("/dev/zero", O_RDWR);
data/libhugetlbfs-2.23/alloc.c:149: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[MAPS_BUF_SZ];
data/libhugetlbfs-2.23/alloc.c:160:7:  [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).
	fd = fopen("/proc/self/maps", "r");
data/libhugetlbfs-2.23/debug.c:33:1:  [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 __hugetlbfs_hostname[64];
data/libhugetlbfs-2.23/elflink.c:93: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 str1[sizeof(val)*8];
data/libhugetlbfs-2.23/elflink.c:94: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 str2[sizeof(val)*8];
data/libhugetlbfs-2.23/elflink.c:159:8:  [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 share_readonly_path[PATH_MAX+1];
data/libhugetlbfs-2.23/elflink.c:352: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 binary[PATH_MAX+1];
data/libhugetlbfs-2.23/elflink.c:402:15:  [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.
			*strtab = (char *)dyntab[i].d_un.d_ptr;
data/libhugetlbfs-2.23/elflink.c:912: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(p + offset, seg->vaddr, seg->filesz + seg->extrasz);
data/libhugetlbfs-2.23/elflink.c:998: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 final_path[PATH_MAX+1];
data/libhugetlbfs-2.23/elflink.c:999: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 tmp_path[PATH_MAX+1];
data/libhugetlbfs-2.23/elflink.c:1008:9:  [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).
		fdx = open(tmp_path, O_CREAT | O_EXCL | O_RDWR, 0666);
data/libhugetlbfs-2.23/elflink.c:1010:9:  [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).
		fds = open(final_path, O_RDONLY);
data/libhugetlbfs-2.23/elflink.c:1185: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 keys[5] = { "R\0" "W\0" "\0" };
data/libhugetlbfs-2.23/hugeadm.c:180:1:  [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 ramdisk_list[PATH_MAX] = "";
data/libhugetlbfs-2.23/hugeadm.c:213:19:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		verbose_level = atoi(env);
data/libhugetlbfs-2.23/hugeadm.c:224:15:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		new_level = atoi(which);
data/libhugetlbfs-2.23/hugeadm.c:242: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 level[3];
data/libhugetlbfs-2.23/hugeadm.c:334: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 data[MAX_SIZE_MNTENT];
data/libhugetlbfs-2.23/hugeadm.c:340: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 format_str[FORMAT_LEN];
data/libhugetlbfs-2.23/hugeadm.c:607: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[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:608: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 options[OPT_MAX];
data/libhugetlbfs-2.23/hugeadm.c:609: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 limits[OPT_MAX];
data/libhugetlbfs-2.23/hugeadm.c:610: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 scaled[OPT_MAX];
data/libhugetlbfs-2.23/hugeadm.c:769: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[ZONEINFO_LINEBUF];
data/libhugetlbfs-2.23/hugeadm.c:775:6:  [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(PROCZONEINFO, "r");
data/libhugetlbfs-2.23/hugeadm.c:963: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[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:964: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 file[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:965: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 mkswap_cmd[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:1008:6:  [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(file, "wx");
data/libhugetlbfs-2.23/hugeadm.c:1048: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 file[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:1070: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 ramdisk[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:1071: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 mkswap_cmd[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:1079: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(ramdisk, O_RDONLY);
data/libhugetlbfs-2.23/hugeadm.c:1169:6:  [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(file, "w");
data/libhugetlbfs-2.23/hugeadm.c:1427: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 base[PATH_MAX];
data/libhugetlbfs-2.23/hugeadm.c:1428: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 *opt_min_adj[MAX_POOLS], *opt_max_adj[MAX_POOLS];
data/libhugetlbfs-2.23/hugeadm.c:1524:21:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
				opt_temp_swap = atoi(optarg);
data/libhugetlbfs-2.23/hugeadm.c:1616:15:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
				opt_gid = atoi(optarg);
data/libhugetlbfs-2.23/hugeadm.c:1660:29:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
			opt_limit_mount_inodes = atoi(optarg);
data/libhugetlbfs-2.23/hugectl.c:105:19:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		verbose_level = atoi(env);
data/libhugetlbfs-2.23/hugectl.c:116:15:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		new_level = atoi(which);
data/libhugetlbfs-2.23/hugectl.c:153: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 level[3];
data/libhugetlbfs-2.23/hugectl.c:195:1:  [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 *map_size[MAP_COUNT];
data/libhugetlbfs-2.23/hugectl.c:203: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 value[128];
data/libhugetlbfs-2.23/hugectl.c:274: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 val[PATH_MAX] = "";
data/libhugetlbfs-2.23/hugeedit.c:213: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(target, (remap_opts ? O_RDWR : O_RDONLY));
data/libhugetlbfs-2.23/hugeutils.c:178: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[MEMINFO_SIZE];
data/libhugetlbfs-2.23/hugeutils.c:183: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(file, O_RDONLY);
data/libhugetlbfs-2.23/hugeutils.c:223: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[20];
data/libhugetlbfs-2.23/hugeutils.c:225: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(file, O_WRONLY);
data/libhugetlbfs-2.23/hugeutils.c:231:11:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
	buflen = sprintf(buf, "%lu", val);
data/libhugetlbfs-2.23/hugeutils.c:249: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("/proc/self/cmdline", O_RDONLY);
data/libhugetlbfs-2.23/hugeutils.c:295:25:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		__hugetlbfs_verbose = atoi(env);
data/libhugetlbfs-2.23/hugeutils.c:305: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 *p, *tok, *exe, buf[MAX_EXE+1], restriction[MAX_EXE];
data/libhugetlbfs-2.23/hugeutils.c:361:28:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
		__hugetlb_opts.sharing = atoi(env);
data/libhugetlbfs-2.23/hugeutils.c:624: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[PATH_MAX+1];
data/libhugetlbfs-2.23/hugeutils.c:625: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[LINE_MAXLEN + 1];
data/libhugetlbfs-2.23/hugeutils.c:632: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("/proc/mounts", O_RDONLY);
data/libhugetlbfs-2.23/hugeutils.c:634:8:  [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("/etc/mtab", O_RDONLY);
data/libhugetlbfs-2.23/hugeutils.c:684: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 path[PATH_MAX + 1];
data/libhugetlbfs-2.23/hugeutils.c:790:32:  [2] (integer) atol:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
			size = size_to_smaller_unit(atol(name));
data/libhugetlbfs-2.23/hugeutils.c:806: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 mmu_type[16];
data/libhugetlbfs-2.23/hugeutils.c:1030: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[PATH_MAX+1];
data/libhugetlbfs-2.23/hugeutils.c:1093: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("/dev/zero", O_RDONLY);
data/libhugetlbfs-2.23/hugeutils.c:1123: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 file[PATH_MAX+1];
data/libhugetlbfs-2.23/hugeutils.c:1138: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 file[PATH_MAX+1];
data/libhugetlbfs-2.23/hugeutils.c:1181: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[MAPS_BUF_SZ];
data/libhugetlbfs-2.23/hugeutils.c:1185:6:  [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("/proc/self/maps", "r");
data/libhugetlbfs-2.23/libhugetlbfs_internal.h: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 mount[PATH_MAX+1];
data/libhugetlbfs-2.23/tests/counters.c:58:8:  [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 *map_addr[NR_SLOTS];
data/libhugetlbfs-2.23/tests/direct.c:36:1:  [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[IOSZ] __attribute__ ((aligned (IOSZ)));
data/libhugetlbfs-2.23/tests/direct.c:54:8:  [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).
	dfd = open(TMPFILE, O_CREAT|O_EXCL|O_DIRECT|O_RDWR, 0600);
data/libhugetlbfs-2.23/tests/direct.c:63: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(p, P0, 8);
data/libhugetlbfs-2.23/tests/empty_mounts.c:36:5:  [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).
int open(const char *path, int flags, ...)
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:88:5:  [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).
int open(const char *file, int flags, ...)
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:105:4:  [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 fname[PATH_MAX];
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:111:4:  [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 fname[PATH_MAX];
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:126: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 fname[PATH_MAX+1];
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:200: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 fname[PATH_MAX+1];
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:226: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(fname, O_WRONLY|O_CREAT, 0600);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:236: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(fname, O_WRONLY|O_CREAT, 0600);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:318: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(a, __e, sizeof(__e));					\
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:393: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(expected_sizes, fake_sizes, sizeof(fake_sizes));
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:403: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(expected_sizes, fake_sizes, sizeof(fake_sizes));
data/libhugetlbfs-2.23/tests/icache-hygiene.c:72: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(p, l, COPY_SIZE);
data/libhugetlbfs-2.23/tests/large_mounts.c:48:5:  [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).
int open(const char *path, int flags, ...)
data/libhugetlbfs-2.23/tests/large_mounts.c:65: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[BUF_SIZE];
data/libhugetlbfs-2.23/tests/large_mounts.c:71:14:  [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).
	mounts_fd = open("/proc/mounts", O_RDONLY);
data/libhugetlbfs-2.23/tests/large_mounts.c:74:15:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
	tmp_stream = tmpfile();
data/libhugetlbfs-2.23/tests/linkhuge.c:76:8:  [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 link_string[32];
data/libhugetlbfs-2.23/tests/linkhuge.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(link_string, p, q-p);
data/libhugetlbfs-2.23/tests/linkshare.c:91:8:  [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 link_string[32];
data/libhugetlbfs-2.23/tests/linkshare.c:112: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(link_string, p, q-p);
data/libhugetlbfs-2.23/tests/linkshare.c:161:14:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
			sharing = atoi(env);
data/libhugetlbfs-2.23/tests/linkshare.c:170: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 execarg1[5];
data/libhugetlbfs-2.23/tests/linkshare.c:366:27:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
			child_process(argv[0], atoi(argv[1]));
data/libhugetlbfs-2.23/tests/meminfo_nohuge.c:36:5:  [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).
int open(const char *path, int flags, ...)
data/libhugetlbfs-2.23/tests/mmap-cow.c:87: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((char *)addr+i, &pattern, 1);
data/libhugetlbfs-2.23/tests/mmap-cow.c:121:17:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	nr_hugepages = atoi(argv[2]);
data/libhugetlbfs-2.23/tests/mmap-cow.c:122:12:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	threads = atoi(argv[1]);
data/libhugetlbfs-2.23/tests/mmap-cow.c:153: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(addr+i, "deadbeef", 8);
data/libhugetlbfs-2.23/tests/mmap-gettest.c:47:8:  [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 hugetlb_mount[BUF_SZ];
data/libhugetlbfs-2.23/tests/mmap-gettest.c:115:9:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	iter = atoi(argv[1]);
data/libhugetlbfs-2.23/tests/mmap-gettest.c:116:17:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	nr_hugepages = atoi(argv[2]);
data/libhugetlbfs-2.23/tests/quota.c:66:1:  [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 result_str[3][10] = { "pass", "killed", "fail" };
data/libhugetlbfs-2.23/tests/quota.c:91: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 mount_str[17];
data/libhugetlbfs-2.23/tests/quota.c:92: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 mount_opts[50];
data/libhugetlbfs-2.23/tests/quota.c:108:2:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
	sprintf(mount_str, "/tmp/huge-XXXXXX");
data/libhugetlbfs-2.23/tests/shm-fork.c:99:13:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	numprocs = atoi(argv[1]);
data/libhugetlbfs-2.23/tests/shm-fork.c:100:17:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	nr_hugepages = atoi(argv[2]);
data/libhugetlbfs-2.23/tests/shm-getraw.c:66:17:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	nr_hugepages = atoi(argv[1]);
data/libhugetlbfs-2.23/tests/shm-getraw.c:74:11:  [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).
	raw_fd = open(argv[2], O_RDONLY);
data/libhugetlbfs-2.23/tests/shm-getraw.c:97: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((char*)(shmaddr + i), buffer, hpage_size);
data/libhugetlbfs-2.23/tests/shm-gettest.c:100:9:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	iter = atoi(argv[1]);
data/libhugetlbfs-2.23/tests/shm-gettest.c:101:17:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	nr_hugepages = atoi(argv[2]);
data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c:57:8:  [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 *map_addr[NR_SLOTS];
data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c:112: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[MEMINFO_SIZE];
data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c:117: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("/proc/meminfo", O_RDONLY);
data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c:148:7:  [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).
	fd = fopen("/proc/sys/vm/nr_hugepages", "w");
data/libhugetlbfs-2.23/tests/task-size-overrun.c:39: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[MAPS_BUF_SZ];
data/libhugetlbfs-2.23/tests/task-size-overrun.c:44:6:  [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("/proc/self/maps", "r");
data/libhugetlbfs-2.23/tests/testutils.c:62: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 gid_buffer[64] = {0};
data/libhugetlbfs-2.23/tests/testutils.c:71: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("/proc/sys/vm/hugetlb_shm_group", O_RDONLY);
data/libhugetlbfs-2.23/tests/testutils.c:79:22:  [2] (integer) atoi:
  Unless checked, the resulting number can exceed the expected range
  (CWE-190). If source untrusted, check both minimum and maximum, even if the
  input had no minus sign (large numbers can roll over into negative number;
  consider saving to an unsigned value if that is intended).
	hugetlb_shm_group = atoi(gid_buffer);
data/libhugetlbfs-2.23/tests/testutils.c:89: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 cpu_state, path_buf[64];
data/libhugetlbfs-2.23/tests/testutils.c:101:8:  [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(path_buf, O_RDONLY);
data/libhugetlbfs-2.23/tests/testutils.c:175: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[MAPS_BUF_SZ];
data/libhugetlbfs-2.23/tests/testutils.c:178:6:  [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("/proc/self/maps", "r");
data/libhugetlbfs-2.23/tests/testutils.c:216: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[MAPS_BUF_SZ];
data/libhugetlbfs-2.23/tests/testutils.c:219:6:  [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("/proc/self/maps", "r");
data/libhugetlbfs-2.23/tests/testutils.c:266: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[MAPS_BUF_SZ];
data/libhugetlbfs-2.23/tests/testutils.c:270:6:  [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("/proc/self/smaps", "r");
data/libhugetlbfs-2.23/tests/testutils.c:278: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 map_name[256];
data/libhugetlbfs-2.23/tests/testutils.c:279: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 buf[64];
data/libhugetlbfs-2.23/tests/testutils.c:315: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[256];
data/libhugetlbfs-2.23/tests/testutils.c:349: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[256];
data/libhugetlbfs-2.23/hugeadm.c:384: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).
			length = strlen(current->entry.mnt_dir);
data/libhugetlbfs-2.23/hugeadm.c:479: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).
	if (!path || strlen(path) == 0)
data/libhugetlbfs-2.23/hugeadm.c:706: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).
			size_t maxlen = OPT_MAX - strlen(options);
data/libhugetlbfs-2.23/hugeadm.c:707: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).
			if (maxlen > strlen(limits))
data/libhugetlbfs-2.23/hugeadm.c:1131:3:  [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(ramdisk_list, " ");
data/libhugetlbfs-2.23/hugeutils.c:189:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	len = read(fd, buf, sizeof(buf));
data/libhugetlbfs-2.23/hugeutils.c:207: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).
		p += strlen(tag);
data/libhugetlbfs-2.23/hugeutils.c:254:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	nread = read(fd, buf, size-1);
data/libhugetlbfs-2.23/hugeutils.c:310:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(restriction, env, sizeof restriction);
data/libhugetlbfs-2.23/hugeutils.c:534:5:  [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(__hugetlb_opts.def_page_size) > 0);
data/libhugetlbfs-2.23/hugeutils.c:572: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) > PATH_MAX)
data/libhugetlbfs-2.23/hugeutils.c:598: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(hpage_sizes[idx].mount)) {
data/libhugetlbfs-2.23/hugeutils.c:642:18:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while ((bytes = read(fd, line, LINE_MAXLEN)) > 0) {
data/libhugetlbfs-2.23/hugeutils.c:668:4:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
			strncpy(path, match, end - match);
data/libhugetlbfs-2.23/hugeutils.c:694:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
		strncpy(path, __hugetlb_opts.path, next - __hugetlb_opts.path);
data/libhugetlbfs-2.23/hugeutils.c:1012: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).
		if (strlen(path))
data/libhugetlbfs-2.23/tests/direct.c:75:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	ret = read(dfd, buf, IOSZ);
data/libhugetlbfs-2.23/tests/direct.c:87:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	ret = read(dfd, p, IOSZ);
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:230:4:  [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(meminfo_base)) != strlen(meminfo_base))
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:230: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).
			strlen(meminfo_base)) != strlen(meminfo_base))
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:240:4:  [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(meminfo_base)) != strlen(meminfo_base))
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:240: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).
			strlen(meminfo_base)) != strlen(meminfo_base))
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:243:4:  [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(meminfo_huge)) != strlen(meminfo_huge))
data/libhugetlbfs-2.23/tests/gethugepagesizes.c:243: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).
			strlen(meminfo_huge)) != strlen(meminfo_huge))
data/libhugetlbfs-2.23/tests/large_mounts.c:82: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).
	filler_sz = strlen(FILLER);
data/libhugetlbfs-2.23/tests/large_mounts.c:91:16:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	while ((ret = read(mounts_fd, buf, BUF_SIZE)) > 0)
data/libhugetlbfs-2.23/tests/ptrace-write-hugepage.c:136:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	err = read(pipefd[0], &p, sizeof(p));
data/libhugetlbfs-2.23/tests/shm-getraw.c:94:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		if (!read(raw_fd, buffer, hpage_size))
data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c:121:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	len = read(fd, buf, sizeof(buf));
data/libhugetlbfs-2.23/tests/shmoverride_unlinked.c:134: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).
	p += strlen(tag);
data/libhugetlbfs-2.23/tests/testutils.c:75:8:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	ret = read(fd, &gid_buffer, sizeof(gid_buffer));
data/libhugetlbfs-2.23/tests/testutils.c:114:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
		ret = read(fd, &cpu_state, 1);
data/libhugetlbfs-2.23/tests/testutils.c:193:9:  [1] (buffer) sscanf:
  It's unclear if the %s limit in the format string is small enough
  (CWE-120). Check that the limit is sufficiently small, or use a different
  input function.
		ret = sscanf(line, "%lx-%lx %*s %lx %*s %ld %255s",

ANALYSIS SUMMARY:

Hits = 262
Lines analyzed = 16862 in approximately 0.83 seconds (20202 lines/second)
Physical Source Lines of Code (SLOC) = 10780
Hits@level = [0] 122 [1]  33 [2] 138 [3]  44 [4]  40 [5]   7
Hits@level+ = [0+] 384 [1+] 262 [2+] 229 [3+]  91 [4+]  47 [5+]   7
Hits/KSLOC@level+ = [0+] 35.6215 [1+] 24.3043 [2+] 21.243 [3+] 8.44156 [4+] 4.35993 [5+] 0.649351
Symlinks skipped = 1 (--allowlink overrides but see doc for security issue)
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.