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/purelibc-1.0.4/config.h
Examining data/purelibc-1.0.4/dir.c
Examining data/purelibc-1.0.4/exec.c
Examining data/purelibc-1.0.4/kernel_termios.ppc.h
Examining data/purelibc-1.0.4/purelibc.h
Examining data/purelibc-1.0.4/socketcalls.c
Examining data/purelibc-1.0.4/stdio.c
Examining data/purelibc-1.0.4/syscalls.c

FINAL RESULTS:

data/purelibc-1.0.4/stdio.c:280:7:  [5] (buffer) gets:
  Does not check for buffer overflows (CWE-120, CWE-20). Use fgets() instead.
char *gets(char *s)
data/purelibc-1.0.4/syscalls.c:378:9:  [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.
ssize_t readlink(const char* pathname,char* buf, size_t bufsize){
data/purelibc-1.0.4/syscalls.c:402:5:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
int chmod(const char* pathname,mode_t mode){
data/purelibc-1.0.4/syscalls.c:414:5:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
int chown(const char* pathname,uid_t owner,gid_t group){
data/purelibc-1.0.4/dir.c:101:3:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
		strcpy(dir->de32.d_name,de64->d_name);
data/purelibc-1.0.4/exec.c:35:5:  [4] (shell) execl:
  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.
int execl(const char *path, const char *arg, ...){
data/purelibc-1.0.4/exec.c:52:5:  [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.
int execlp(const char *file, const char *arg, ...){
data/purelibc-1.0.4/exec.c:65:9:  [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.
	return execvp(file,argv);
data/purelibc-1.0.4/exec.c:68:5:  [4] (shell) execle:
  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.
int execle(const char *path, const char *arg , .../*, char * const envp[]*/){
data/purelibc-1.0.4/exec.c:86:5:  [4] (shell) execv:
  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.
int execv(const char *path, char *const argv[]){
data/purelibc-1.0.4/exec.c:90:5:  [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.
int execvp(const char *file, char *const argv[]){
data/purelibc-1.0.4/stdio.c:245:5:  [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.
int printf (const char *format, ...)
data/purelibc-1.0.4/stdio.c:251:9:  [4] (format) vfprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
	done = vfprintf (stdout, format, arg);
data/purelibc-1.0.4/stdio.c:263:5:  [4] (buffer) scanf:
  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 the scanf format is influenceable by an
  attacker, it's exploitable.
int scanf (const char *format, ...)
data/purelibc-1.0.4/stdio.c:269:9:  [4] (buffer) vfscanf:
  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 the scanf format is influenceable by an
  attacker, it's exploitable.
	done = vfscanf (stdin, format, arg);
data/purelibc-1.0.4/syscalls.c:366:5:  [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.
int access(const char* pathname,int mode){
data/purelibc-1.0.4/syscalls.c:375:9:  [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.
	return access(pathname,mode);
data/purelibc-1.0.4/exec.c:98:16:  [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 ((envpath=getenv("PATH")) == NULL)
data/purelibc-1.0.4/syscalls.c:889:5:  [3] (misc) chroot:
  chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22).
  Make sure the program immediately chdir("/"), closes file descriptors, and
  drops root privileges, and that all necessary files (and no more!) are in
  the new root.
int chroot(const char *path){
data/purelibc-1.0.4/dir.c:40: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[PURE_DIRBUF_SIZE];
data/purelibc-1.0.4/dir.c:62: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(name, O_RDONLY | O_DIRECTORY);
data/purelibc-1.0.4/dir.c:173: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(newel, de, elsize);
data/purelibc-1.0.4/exec.c:42: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 *argv[argc];
data/purelibc-1.0.4/exec.c:59: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 *argv[argc];
data/purelibc-1.0.4/exec.c:76: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 *argv[argc];
data/purelibc-1.0.4/exec.c:97: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[PATH_MAX];
data/purelibc-1.0.4/stdio.c:156:10:  [2] (misc) open:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
	if ((fd=open(filename,flags,0666)) < 0)
data/purelibc-1.0.4/stdio.c:162: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).
FILE *fopen (const char *filename, const char *modes){
data/purelibc-1.0.4/stdio.c:174:7:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
FILE *tmpfile (void){
data/purelibc-1.0.4/stdio.c:176: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 template[20] = "/tmp/tmpfile-XXXXXX";
data/purelibc-1.0.4/stdio.c:177:10:  [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).
	if ((fd=mkstemp(template))<0)
data/purelibc-1.0.4/stdio.c:187: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 template[20] = "/tmp/tmpfile-XXXXXX";
data/purelibc-1.0.4/stdio.c:188:10:  [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).
	if ((fd=mkstemp(template))<0)
data/purelibc-1.0.4/stdio.c:203:13:  [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 fdtmp=open(filename,_pure_parse_mode(modes),0666);
data/purelibc-1.0.4/syscalls.c:113: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* pathname,int flags,...){
data/purelibc-1.0.4/syscalls.c:563:4:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
			memcpy(iov[i].iov_base, scan, iov[i].iov_len);
data/purelibc-1.0.4/syscalls.c:598:4:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
			memcpy(scan, iov[i].iov_base, iov[i].iov_len);
data/purelibc-1.0.4/syscalls.c:930:7:  [2] (race) vfork:
  On some old systems, vfork() permits race conditions, and it's very
  difficult to use correctly (CWE-362). Use fork() instead.
pid_t vfork(void){
data/purelibc-1.0.4/syscalls.c:1544:32:  [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.
int futimesat(int dirfd, const char *pathname, const struct timeval times[2]) {
data/purelibc-1.0.4/syscalls.c:1678:32:  [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.
int utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags){
data/purelibc-1.0.4/stdio.c:54:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	return read(p->fd,buf,count);
data/purelibc-1.0.4/stdio.c:275:5:  [1] (buffer) getchar:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
int getchar (void)
data/purelibc-1.0.4/stdio.c:277:9:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
	return getc(stdin);
data/purelibc-1.0.4/syscalls.c:90:39:  [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).
		_pure_native_syscall(__NR_write,2,s,strlen(s));
data/purelibc-1.0.4/syscalls.c:157:9:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
ssize_t read(int fd,void* buf,size_t count){
data/purelibc-1.0.4/syscalls.c:885:8:  [1] (access) umask:
  Ensure that umask is given most restrictive possible setting (e.g., 066 or
  077) (CWE-732).
mode_t umask(mode_t mask){

ANALYSIS SUMMARY:

Hits = 46
Lines analyzed = 2591 in approximately 0.09 seconds (30190 lines/second)
Physical Source Lines of Code (SLOC) = 2100
Hits@level = [0]   5 [1]   6 [2]  21 [3]   2 [4]  13 [5]   4
Hits@level+ = [0+]  51 [1+]  46 [2+]  40 [3+]  19 [4+]  17 [5+]   4
Hits/KSLOC@level+ = [0+] 24.2857 [1+] 21.9048 [2+] 19.0476 [3+] 9.04762 [4+] 8.09524 [5+] 1.90476
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.