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/nickle-2.87/alarm.c Examining data/nickle-2.87/array.c Examining data/nickle-2.87/atom.c Examining data/nickle-2.87/bench/choose.c Examining data/nickle-2.87/bench/composite.c Examining data/nickle-2.87/bench/ifact.c Examining data/nickle-2.87/bench/rfact.c Examining data/nickle-2.87/box.c Examining data/nickle-2.87/builtin-bsdrandom.c Examining data/nickle-2.87/builtin-command.c Examining data/nickle-2.87/builtin-date.c Examining data/nickle-2.87/builtin-debug.c Examining data/nickle-2.87/builtin-environ.c Examining data/nickle-2.87/builtin-file.c Examining data/nickle-2.87/builtin-foreign.c Examining data/nickle-2.87/builtin-gcd.c Examining data/nickle-2.87/builtin-math.c Examining data/nickle-2.87/builtin-namespaces.h Examining data/nickle-2.87/builtin-pid.c Examining data/nickle-2.87/builtin-semaphore.c Examining data/nickle-2.87/builtin-sockets.c Examining data/nickle-2.87/builtin-string.c Examining data/nickle-2.87/builtin-thread.c Examining data/nickle-2.87/builtin-toplevel.c Examining data/nickle-2.87/builtin.c Examining data/nickle-2.87/builtin.h Examining data/nickle-2.87/compile.c Examining data/nickle-2.87/debug.c Examining data/nickle-2.87/divide.c Examining data/nickle-2.87/edit.c Examining data/nickle-2.87/error.c Examining data/nickle-2.87/execute.c Examining data/nickle-2.87/expr.c Examining data/nickle-2.87/file.c Examining data/nickle-2.87/float.c Examining data/nickle-2.87/foreign.c Examining data/nickle-2.87/frame.c Examining data/nickle-2.87/func.c Examining data/nickle-2.87/gcd.c Examining data/nickle-2.87/hash.c Examining data/nickle-2.87/int.c Examining data/nickle-2.87/integer.c Examining data/nickle-2.87/io.c Examining data/nickle-2.87/main.c Examining data/nickle-2.87/mem.c Examining data/nickle-2.87/mem.h Examining data/nickle-2.87/memp.h Examining data/nickle-2.87/natural.c Examining data/nickle-2.87/nickle.h Examining data/nickle-2.87/opcode.h Examining data/nickle-2.87/pretty.c Examining data/nickle-2.87/profile.c Examining data/nickle-2.87/rational.c Examining data/nickle-2.87/ref.c Examining data/nickle-2.87/ref.h Examining data/nickle-2.87/refer.c Examining data/nickle-2.87/sched.c Examining data/nickle-2.87/scope.c Examining data/nickle-2.87/stack.c Examining data/nickle-2.87/stack.h Examining data/nickle-2.87/string.c Examining data/nickle-2.87/struct.c Examining data/nickle-2.87/symbol.c Examining data/nickle-2.87/sync.c Examining data/nickle-2.87/test/math-tables.c Examining data/nickle-2.87/test.c Examining data/nickle-2.87/type.c Examining data/nickle-2.87/union.c Examining data/nickle-2.87/util.c Examining data/nickle-2.87/value.c Examining data/nickle-2.87/value.h FINAL RESULTS: data/nickle-2.87/atom.c:88: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 (AtomEntryName(atomEntry), name); data/nickle-2.87/builtin-sockets.c:239:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (addr->sun_path, local_socket); data/nickle-2.87/edit.c:36:12: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. (void) sprintf (buf, "%s %s", editor, file_name); data/nickle-2.87/edit.c:38:11: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. ret = system (buf); data/nickle-2.87/edit.c:53:12: [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). (void) strcpy (tmpName, template); data/nickle-2.87/edit.c:57:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (nickleName, tmpName); data/nickle-2.87/edit.c:58: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 (nickleName, exten); data/nickle-2.87/file.c:834: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 (program, args); data/nickle-2.87/string.c:249:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy (StringChars (&ret->string), str); data/nickle-2.87/util.c:103:11: [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 (buf, sizeof (buf), format, ap); data/nickle-2.87/util.c:116:11: [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 (buf, sizeof (buf), format, ap); data/nickle-2.87/builtin-bsdrandom.c:56:16: [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. ret = NewInt (random () & ((1 << n) - 1)); data/nickle-2.87/builtin-bsdrandom.c:66:5: [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 ((unsigned int) n); data/nickle-2.87/builtin-environ.c:69: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. c = getenv (name); data/nickle-2.87/builtin-environ.c:87: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. if (getenv (name)) data/nickle-2.87/builtin-environ.c:102: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. if (getenv (name)) data/nickle-2.87/builtin.c:358:12: [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. home = getenv ("HOME"); data/nickle-2.87/builtin.c:370: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. v = getenv (env->var); data/nickle-2.87/edit.c:32:20: [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 (!(editor = getenv ("EDITOR"))) data/nickle-2.87/main.c:59: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. if ((nicklestart = getenv ("NICKLESTART")) == 0) data/nickle-2.87/mem.c:246: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. if (getenv ("NICKLE_MEM_DEBUG")) data/nickle-2.87/array.c:385:6: [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 (n, o, good * sizeof (BoxPtr)); data/nickle-2.87/box.c:175:6: [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 (BoxTypesElements (new), BoxTypesElements (bt), data/nickle-2.87/builtin-sockets.c:207: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[UN_SOCK_MAX]; data/nickle-2.87/builtin-sockets.c:511:5: [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 hostname[HOST_NAME_MAX+1]; data/nickle-2.87/builtin-string.c:191:5: [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 (rchars, a, size); data/nickle-2.87/compile.c:115: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 (ObjCode (nobj, 0), ObjCode (obj, 0), obj->used * sizeof (Inst)); data/nickle-2.87/compile.c:116: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 (ObjStat (nobj, 0), ObjStat (obj, 0), obj->used_stat * sizeof (Stat)); data/nickle-2.87/edit.c:28:5: [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[1024]; data/nickle-2.87/edit.c:49:5: [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 tmpName[sizeof (template)]; data/nickle-2.87/edit.c:50:5: [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 nickleName[sizeof (template) + sizeof (exten) + 2]; data/nickle-2.87/edit.c:54: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). fd = mkstemp (tmpName); data/nickle-2.87/file.c:704: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). fd = open (name, oflags, 0666); data/nickle-2.87/file.c:763: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). fd = open (name, oflags, 0666); data/nickle-2.87/file.c:903:5: [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 (FileBuffer (file->file.input), string, len); data/nickle-2.87/file.c:925:5: [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(s, FileBuffer(out), out->used); data/nickle-2.87/file.c:1285:5: [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 space[64], *s; data/nickle-2.87/file.c:1408: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 dest[7]; data/nickle-2.87/file.c:2078:5: [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[6]; data/nickle-2.87/int.c:232:5: [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 space[64], *s; data/nickle-2.87/mem.c:276: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 (roots, Roots, RootCount * sizeof (void *)); data/nickle-2.87/natural.c:324: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 (x, result, xlen * sizeof (digit)); data/nickle-2.87/string.c:30:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy (StringChars(&ret->string), data/nickle-2.87/string.c:33:12: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. (void) memcpy (StringChars(&ret->string) + av->string.length, data/nickle-2.87/util.c:99:5: [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[4096]; data/nickle-2.87/util.c:112:5: [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[4096]; data/nickle-2.87/value.h:604:5: [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 chars[0]; data/nickle-2.87/value.h:655:14: [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. unsigned char buffer[0]; data/nickle-2.87/atom.c:85:61: [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). atomEntry = ALLOCATE (&AtomEntryType, sizeof (AtomEntry) + strlen (name) + 1); data/nickle-2.87/builtin-sockets.c:22:49: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). (sizeof(*(ptr)) - sizeof((ptr)->sun_path) + strlen((ptr)->sun_path) + 1) data/nickle-2.87/builtin-sockets.c:235:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (strlen (local_socket) > UN_SOCK_MAX) data/nickle-2.87/compile.c:4525:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). " " + strlen(OpNames[inst->base.opCode]), data/nickle-2.87/file.c:842:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). nread = read(errpipe[0], &errcode, 1); data/nickle-2.87/file.c:1061:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read (file->file.fd, buf, n); data/nickle-2.87/file.c:1839:27: [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). FilePutString (file, s, strlen(s), 'v'); data/nickle-2.87/gcd.c:123:2: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask |= imask; data/nickle-2.87/gcd.c:124:10: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). if (u & umask) data/nickle-2.87/int.c:275:11: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (s); data/nickle-2.87/string.c:188:31: [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 (!ValueIsString (v) || strlen (StringChars(&v->string)) != v->string.length) data/nickle-2.87/string.c:248:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). ret = NewString (strlen (str)); ANALYSIS SUMMARY: Hits = 60 Lines analyzed = 32360 in approximately 0.61 seconds (53251 lines/second) Physical Source Lines of Code (SLOC) = 27435 Hits@level = [0] 42 [1] 12 [2] 27 [3] 10 [4] 11 [5] 0 Hits@level+ = [0+] 102 [1+] 60 [2+] 48 [3+] 21 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 3.71788 [1+] 2.18699 [2+] 1.74959 [3+] 0.765446 [4+] 0.400948 [5+] 0 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.