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/mathomatic-16.0.5/am.c Examining data/mathomatic-16.0.5/cmds.c Examining data/mathomatic-16.0.5/complex.c Examining data/mathomatic-16.0.5/complex_lib.c Examining data/mathomatic-16.0.5/diff.c Examining data/mathomatic-16.0.5/factor.c Examining data/mathomatic-16.0.5/factor_int.c Examining data/mathomatic-16.0.5/gcd.c Examining data/mathomatic-16.0.5/globals.c Examining data/mathomatic-16.0.5/help.c Examining data/mathomatic-16.0.5/integrate.c Examining data/mathomatic-16.0.5/list.c Examining data/mathomatic-16.0.5/main.c Examining data/mathomatic-16.0.5/parse.c Examining data/mathomatic-16.0.5/poly.c Examining data/mathomatic-16.0.5/simplify.c Examining data/mathomatic-16.0.5/solve.c Examining data/mathomatic-16.0.5/super.c Examining data/mathomatic-16.0.5/unfactor.c Examining data/mathomatic-16.0.5/altproto.h Examining data/mathomatic-16.0.5/am.h Examining data/mathomatic-16.0.5/blt.h Examining data/mathomatic-16.0.5/complex.h Examining data/mathomatic-16.0.5/externs.h Examining data/mathomatic-16.0.5/license.h Examining data/mathomatic-16.0.5/proto.h Examining data/mathomatic-16.0.5/standard.h Examining data/mathomatic-16.0.5/primes/matho-sumsq.c Examining data/mathomatic-16.0.5/primes/lsqrt.c Examining data/mathomatic-16.0.5/primes/matho-primes.c Examining data/mathomatic-16.0.5/primes/matho-pascal.c Examining data/mathomatic-16.0.5/lib/mathomatic.h Examining data/mathomatic-16.0.5/lib/lib.c Examining data/mathomatic-16.0.5/lib/testmain.c Examining data/mathomatic-16.0.5/lib/example.c Examining data/mathomatic-16.0.5/examples/limits.c Examining data/mathomatic-16.0.5/examples/intfact.c Examining data/mathomatic-16.0.5/examples/fact.c Examining data/mathomatic-16.0.5/examples/roots.c Examining data/mathomatic-16.0.5/includes.h FINAL RESULTS: data/mathomatic-16.0.5/cmds.c:53:66: [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). #define APPEND(str) { if (strlen(str) + cl1_len < sizeof(cl1)) { strcpy(&cl1[cl1_len], str); cl1_len += strlen(str); } else warning(_("Expression too large to plot; omitted.")); } data/mathomatic-16.0.5/cmds.c:1423:18: [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. pre_existing = (access(rc_file, F_OK) == 0); data/mathomatic-16.0.5/cmds.c:4707: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(cp, R_OK | W_OK)) { data/mathomatic-16.0.5/cmds.c:4745: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(cp, F_OK) == 0) { data/mathomatic-16.0.5/cmds.c:4746: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(cp, W_OK)) { data/mathomatic-16.0.5/help.c:619:22: [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 (*cp1 == '/' && access(cp1, X_OK)) { data/mathomatic-16.0.5/help.c:820:7: [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. rv = system(cp); data/mathomatic-16.0.5/list.c:279:10: [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. len += fprintf(gfp, EQUATE_STRING); data/mathomatic-16.0.5/list.c:333: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(gfp, EQUATE_STRING); data/mathomatic-16.0.5/list.c:542: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(cp, EQUATE_STRING); data/mathomatic-16.0.5/list.c:598:37: [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). #define APPEND(str) { if (string) { strcpy(&string[len], str); } if (outflag) { fprintf(gfp, "%s", str); } len += strlen(str); } data/mathomatic-16.0.5/list.c:801:10: [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. len += fprintf(gfp, EQUATE_STRING); data/mathomatic-16.0.5/list.c:846: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(cp, EQUATE_STRING); data/mathomatic-16.0.5/list.c:1082: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(cp, vscreen[i]); data/mathomatic-16.0.5/primes/matho-pascal.c:211: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(gline_buf, buf2); data/mathomatic-16.0.5/am.c:1584: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. cp = getenv("HOME"); data/mathomatic-16.0.5/cmds.c:1476:11: [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. cp1 = getenv("HOME"); data/mathomatic-16.0.5/cmds.c:4619: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. cp1 = getenv("EDITOR"); data/mathomatic-16.0.5/help.c:613: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. cp1 = getenv("SHELL"); data/mathomatic-16.0.5/main.c:151:14: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((i = getopt(argc, argv, "s:abqrtdchuvwxm:e")) >= 0) { data/mathomatic-16.0.5/main.c:248: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. if ((cp = getenv("HOME"))) { data/mathomatic-16.0.5/primes/matho-primes.c:172:14: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((i = getopt(argc, argv, "c:thuvp:m:")) >= 0) { data/mathomatic-16.0.5/am.c:849: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[DEFAULT_N_TOKENS]; data/mathomatic-16.0.5/am.c:882: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/am.c:1038: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/am.c:1580: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/am.c:1587:8: [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). fp = fopen(rc_file, "r"); data/mathomatic-16.0.5/am.c:1592:8: [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). fp = fopen(rc_file, "r"); data/mathomatic-16.0.5/am.c:1596:8: [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). fp = fopen(rc_file, "r"); data/mathomatic-16.0.5/am.c:1636: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/am.c:1641: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). fp = fopen(rc_file, "r"); data/mathomatic-16.0.5/am.h:157:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. typedef char sign_array_type[MAX_SUBSCRIPT+2]; /* boolean array for generating unique "sign" variables */ data/mathomatic-16.0.5/cmds.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 *cp1, cl[16384+MAX_CMD_LEN], cl1[16384], cl2[MAX_CMD_LEN], *exp_str; data/mathomatic-16.0.5/cmds.c:452: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:681: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 *cp1, buf[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:911: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 var_name_buf[MAX_VAR_LEN]; data/mathomatic-16.0.5/cmds.c:1205: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:1424:12: [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). if ((fp = fopen(rc_file, "w")) == NULL) { data/mathomatic-16.0.5/cmds.c:1952: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:1987: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 exists[N_EQUATIONS]; data/mathomatic-16.0.5/cmds.c:2111:6: [2] (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 string. strcat(var_str, "_imag"); data/mathomatic-16.0.5/cmds.c:2113:6: [2] (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 string. strcat(var_str, "_real"); data/mathomatic-16.0.5/cmds.c:2301: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:3044: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 used[N_EQUATIONS]; data/mathomatic-16.0.5/cmds.c:3046: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:3302: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 cl[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:3507: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 imag_array[N_EQUATIONS]; data/mathomatic-16.0.5/cmds.c:4049: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:4476: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:4478: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 cl[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:4522: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). fp = fopen(buf, "r"); data/mathomatic-16.0.5/cmds.c:4525:8: [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). fp = fopen(buf, "r"); data/mathomatic-16.0.5/cmds.c:4614: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 cl[MAX_CMD_LEN]; /* command-line */ data/mathomatic-16.0.5/cmds.c:4658: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_file[MAX_CMD_LEN]; data/mathomatic-16.0.5/cmds.c:4673:8: [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). fp = fopen(tmp_file, "w+"); data/mathomatic-16.0.5/cmds.c:4681:8: [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(tmp_file); data/mathomatic-16.0.5/cmds.c:4764: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). fp = fopen(cp, "w"); data/mathomatic-16.0.5/complex.c:55: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[MAX_CMD_LEN]; data/mathomatic-16.0.5/externs.h:64: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. extern char special_variable_characters[256]; data/mathomatic-16.0.5/externs.h:65: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. extern char plot_prefix[256]; data/mathomatic-16.0.5/externs.h:89: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. extern char *var_names[MAX_VAR_NAMES]; data/mathomatic-16.0.5/externs.h:90: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. extern char var_str[MAX_VAR_LEN+80]; data/mathomatic-16.0.5/externs.h: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. extern char prompt_str[MAX_PROMPT_LEN]; data/mathomatic-16.0.5/externs.h:93: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. extern char rc_file[MAX_CMD_LEN]; data/mathomatic-16.0.5/externs.h:104: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. extern char history_filename_storage[MAX_CMD_LEN]; data/mathomatic-16.0.5/externs.h:135: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. extern char *vscreen[TEXT_ROWS]; data/mathomatic-16.0.5/globals.c:77: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 special_variable_characters[256] = "\\[]"; /* allow backslash in variable names for Latex compatibility */ data/mathomatic-16.0.5/globals.c:79: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 special_variable_characters[256] = "'\\[]"; /* user defined characters for variable names, '\0' terminated */ data/mathomatic-16.0.5/globals.c:82: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 plot_prefix[256] = "set grid; set xlabel 'X'; set ylabel 'Y';"; /* prefix fed into gnuplot before the plot command */ data/mathomatic-16.0.5/globals.c:84: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 plot_prefix[256] = "set grid; set xlabel \"X\"; set ylabel \"Y\";"; /* prefix fed into gnuplot before the plot command */ data/mathomatic-16.0.5/globals.c:114: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 *var_names[MAX_VAR_NAMES]; /* index for storage of variable name strings */ data/mathomatic-16.0.5/globals.c:115: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 var_str[MAX_VAR_LEN+80]; /* temp storage for listing a variable name */ data/mathomatic-16.0.5/globals.c:116: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 prompt_str[MAX_PROMPT_LEN]; /* temp storage for the prompt string */ data/mathomatic-16.0.5/globals.c:118: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 rc_file[MAX_CMD_LEN]; /* pathname for the set options startup file */ data/mathomatic-16.0.5/globals.c:129: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 history_filename_storage[MAX_CMD_LEN]; data/mathomatic-16.0.5/globals.c:173: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 *vscreen[TEXT_ROWS]; data/mathomatic-16.0.5/help.c:508: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 buf2[MAX_CMD_LEN]; /* do not make this static! */ data/mathomatic-16.0.5/help.c:682:12: [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). fp = fopen(gfp_filename, "a"); data/mathomatic-16.0.5/help.c:684:12: [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). fp = fopen(gfp_filename, "w"); data/mathomatic-16.0.5/integrate.c:256: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 var_name_buf[MAX_VAR_LEN], *cp_start; data/mathomatic-16.0.5/lib/testmain.c:18: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[10000]; /* input buffer */ data/mathomatic-16.0.5/list.c:615: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[500], buf2[500]; data/mathomatic-16.0.5/list.c:879: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[500], buf2[500]; data/mathomatic-16.0.5/list.c:1103: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[50]; data/mathomatic-16.0.5/list.c:1244: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[500]; data/mathomatic-16.0.5/parse.c:660: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[MAX_VAR_LEN+1]; data/mathomatic-16.0.5/primes/matho-pascal.c:72: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 gline_buf[1000]; data/mathomatic-16.0.5/primes/matho-pascal.c:100: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). glines = atoi(argv[1]); data/mathomatic-16.0.5/primes/matho-pascal.c:193: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 buf2[100]; data/mathomatic-16.0.5/primes/matho-primes.c:144: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[1000]; data/mathomatic-16.0.5/primes/matho-sumsq.c:159: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 *cp, buf[1000]; data/mathomatic-16.0.5/simplify.c:184: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 *cp, buf[100]; data/mathomatic-16.0.5/simplify.c:1913: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 used[MAX_COMPARE_TERMS]; /* operand used flag array 2 */ data/mathomatic-16.0.5/solve.c:1145: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 var_name_buf[MAX_VAR_LEN]; data/mathomatic-16.0.5/am.c:973: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). input_column = strlen(prompt_str); data/mathomatic-16.0.5/am.c:1013: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). i = strlen(string) - 1; data/mathomatic-16.0.5/am.c:1557: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). i = strlen(cp); data/mathomatic-16.0.5/cmds.c:53: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). #define APPEND(str) { if (strlen(str) + cl1_len < sizeof(cl1)) { strcpy(&cl1[cl1_len], str); cl1_len += strlen(str); } else warning(_("Expression too large to plot; omitted.")); } data/mathomatic-16.0.5/cmds.c:53:105: [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). #define APPEND(str) { if (strlen(str) + cl1_len < sizeof(cl1)) { strcpy(&cl1[cl1_len], str); cl1_len += strlen(str); } else warning(_("Expression too large to plot; omitted.")); } data/mathomatic-16.0.5/cmds.c:1921:18: [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). while ((len + strlen(cp)) < width) { data/mathomatic-16.0.5/cmds.c:1923:12: [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(cp); data/mathomatic-16.0.5/cmds.c:4524: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). buf[strlen(cp)] = '\0'; data/mathomatic-16.0.5/help.c:645:68: [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). #define COMPARE_COMMAND_NAME(str) (len >= min(CMD_REQUIRED_NCHARS, strlen(str)) \ data/mathomatic-16.0.5/help.c:646:16: [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(str) && strncasecmp(cp, str, len) == 0) data/mathomatic-16.0.5/help.c:669: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). for (i1 = strlen(buf2) - 1; i1 >= 0; i1--) { data/mathomatic-16.0.5/help.c:758:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(cp); data/mathomatic-16.0.5/help.c:769:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). input_column -= (strlen(HTML_PROMPT_STR) - strlen(PROMPT_STR)); data/mathomatic-16.0.5/help.c:769:47: [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). input_column -= (strlen(HTML_PROMPT_STR) - strlen(PROMPT_STR)); data/mathomatic-16.0.5/help.c:783:21: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). input_column -= (strlen(HTML_PROMPT_STR) - strlen(PROMPT_STR)); data/mathomatic-16.0.5/help.c:783:47: [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). input_column -= (strlen(HTML_PROMPT_STR) - strlen(PROMPT_STR)); data/mathomatic-16.0.5/list.c:246: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). j = strlen(buf) - 1; data/mathomatic-16.0.5/list.c:385:10: [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). return(strlen(var_str)); data/mathomatic-16.0.5/list.c:494: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). return(strlen(var_str)); data/mathomatic-16.0.5/list.c:531:10: [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(EQUATE_STRING); data/mathomatic-16.0.5/list.c:543:37: [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). list_string(rhs[n], n_rhs[n], &cp[strlen(cp)], export_flag); data/mathomatic-16.0.5/list.c:546: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(cp, ";"); data/mathomatic-16.0.5/list.c:598:115: [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). #define APPEND(str) { if (string) { strcpy(&string[len], str); } if (outflag) { fprintf(gfp, "%s", str); } len += strlen(str); } data/mathomatic-16.0.5/list.c:599:194: [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). #define APPEND2(str) { if (string) { if ((sbuffer_size - current_len) > 0) my_strlcpy(&string[current_len], str, sbuffer_size - current_len); } else { fprintf(gfp, "%s", str); } current_len += strlen(str); } data/mathomatic-16.0.5/list.c:835:10: [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(EQUATE_STRING); data/mathomatic-16.0.5/list.c:847:45: [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). list_code(rhs[en], &n_rhs[en], false, &cp[strlen(cp)], language, int_flag); data/mathomatic-16.0.5/list.c:852: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(cp, ";"); data/mathomatic-16.0.5/list.c:1046:10: [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(EQUATE_STRING); data/mathomatic-16.0.5/list.c:1060:16: [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). cur_pos += strlen(EQUATE_STRING); data/mathomatic-16.0.5/list.c:1061: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). cur_len = strlen(vscreen[screen_line]); data/mathomatic-16.0.5/list.c:1065: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). pos += strlen(EQUATE_STRING); data/mathomatic-16.0.5/list.c:1072: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). buf_len += strlen(vscreen[i]); data/mathomatic-16.0.5/list.c:1083: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(cp, "\n"); data/mathomatic-16.0.5/list.c:1124:10: [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(EQUATE_STRING); data/mathomatic-16.0.5/list.c:1166:10: [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). pos += strlen(buf); data/mathomatic-16.0.5/list.c:1172: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). pos += strlen(EQUATE_STRING); data/mathomatic-16.0.5/list.c:1248: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). current_len = strlen(string); data/mathomatic-16.0.5/list.c:1481:12: [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(cp); data/mathomatic-16.0.5/list.c:1509:12: [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(cp); data/mathomatic-16.0.5/parse.c:543: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 (strncasecmp(cp, "inf", strlen("inf")) == 0 data/mathomatic-16.0.5/parse.c:544:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). && !isvarchar(cp[strlen("inf")])) { data/mathomatic-16.0.5/parse.c:547: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). cp += strlen("inf"); data/mathomatic-16.0.5/parse.c:548:46: [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). } else if (strncasecmp(cp, INFINITY_NAME, strlen(INFINITY_NAME)) == 0 data/mathomatic-16.0.5/parse.c:549:25: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). && !isvarchar(cp[strlen(INFINITY_NAME)])) { data/mathomatic-16.0.5/parse.c:552: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). cp += strlen(INFINITY_NAME); data/mathomatic-16.0.5/parse.c:774:10: [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(buf) + 1; data/mathomatic-16.0.5/parse.c:814: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). i = strlen(cp) - 1; data/mathomatic-16.0.5/parse.c:841: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(cp1); data/mathomatic-16.0.5/parse.c:924:12: [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_src = strlen(src); data/mathomatic-16.0.5/poly.c:845:46: [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 (cp && strncmpfunc(cp, V_INTEGER_PREFIX, strlen(V_INTEGER_PREFIX)) == 0) data/mathomatic-16.0.5/primes/matho-pascal.c:209:4: [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(gline_buf, " "); data/mathomatic-16.0.5/primes/matho-pascal.c:213:4: [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(gline_buf, " "); data/mathomatic-16.0.5/primes/matho-pascal.c:216: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). return(strlen(gline_buf)); ANALYSIS SUMMARY: Hits = 147 Lines analyzed = 26211 in approximately 0.76 seconds (34398 lines/second) Physical Source Lines of Code (SLOC) = 22029 Hits@level = [0] 720 [1] 53 [2] 72 [3] 7 [4] 15 [5] 0 Hits@level+ = [0+] 867 [1+] 147 [2+] 94 [3+] 22 [4+] 15 [5+] 0 Hits/KSLOC@level+ = [0+] 39.3572 [1+] 6.67302 [2+] 4.2671 [3+] 0.998684 [4+] 0.680921 [5+] 0 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.