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/ries-2018.08.05/ries.c FINAL RESULTS: data/ries-2018.08.05/ries.c:4221: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(fmt, tmp); data/ries-2018.08.05/ries.c:4238:8: [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. If the scanf format is influenceable by an attacker, it's exploitable. nv = sscanf(s1, RV_SS_FMT, &xc); data/ries-2018.08.05/ries.c:6791:11: [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(fmt_g_diff, dv); data/ries-2018.08.05/ries.c:7485:3: [4] (format) snprintf: 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. snprintf(pfw_buf, 40, fmt1, x); data/ries-2018.08.05/ries.c:7487:5: [4] (format) snprintf: 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. snprintf(pfw_buf, 40, fmt2, x); data/ries-2018.08.05/ries.c:8346:9: [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(fmt_g_diff, it->der); /* printf(fmt_g_nominal, it->der); */ data/ries-2018.08.05/ries.c:8982:11: [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(fmt_g_diff, ctdx); data/ries-2018.08.05/ries.c:9001:11: [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(fmt_g_diff, ctdx); data/ries-2018.08.05/ries.c:9047:9: [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(fmt_g_diff, ctdx); data/ries-2018.08.05/ries.c:9110:11: [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(fmt_g_diff, ctdx); data/ries-2018.08.05/ries.c:10781:10: [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. If the scanf format is influenceable by an attacker, it's exploitable. nv = sscanf(s, RV_SS_FMT, &targ); data/ries-2018.08.05/ries.c:10791:11: [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. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(s, RV_SS_FMT, &inc_ulp)) { data/ries-2018.08.05/ries.c:11308:26: [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. If the scanf format is influenceable by an attacker, it's exploitable. if (pa_this_arg && sscanf(pa_this_arg, RV_SS_FMT, &t)) { data/ries-2018.08.05/ries.c:11419:26: [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. If the scanf format is influenceable by an attacker, it's exploitable. if (pa_this_arg && sscanf(pa_this_arg, RV_SS_FMT, &t)) { data/ries-2018.08.05/ries.c:11471:26: [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. If the scanf format is influenceable by an attacker, it's exploitable. if (pa_this_arg && sscanf(pa_this_arg, RV_SS_FMT, &t)) { data/ries-2018.08.05/ries.c:11666:26: [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. If the scanf format is influenceable by an attacker, it's exploitable. if (pa_this_arg && sscanf(pa_this_arg, RV_SS_FMT, &t)) { data/ries-2018.08.05/ries.c:12090:9: [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(fmt_g_diff, dx); data/ries-2018.08.05/ries.c:12262: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. printf(fmt1, "mrob.com/ries"); data/ries-2018.08.05/ries.c:10958: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. hd = getenv("USERPROFILE"); data/ries-2018.08.05/ries.c:10961: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. hd = getenv("HOME"); data/ries-2018.08.05/ries.c:3410: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 fmt_g_nominal[FMT_STR_SIZE]; /* e.g. "%.17g" */ data/ries-2018.08.05/ries.c:3411: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 fmt_g_nom_fixed[FMT_STR_SIZE]; /* e.g. "%-23.17g" */ data/ries-2018.08.05/ries.c:3413: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 fmt_g_usable[FMT_STR_SIZE]; /* e.g. "%.15g" */ data/ries-2018.08.05/ries.c:3414: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 fmt_g_usa_fixed[FMT_STR_SIZE]; /* e.g. "%-21.15g" */ data/ries-2018.08.05/ries.c:3416: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 fmt_g_diff[FMT_STR_SIZE]; /* e.g. "%.7g" */ data/ries-2018.08.05/ries.c:3417: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 fmt_g_dif_fixed[FMT_STR_SIZE]; /* e.g. "%-13.7g" */ data/ries-2018.08.05/ries.c:4033: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 s2[40]; data/ries-2018.08.05/ries.c:4034: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 sexp[8]; /* Signed exponent as a string */ data/ries-2018.08.05/ries.c:4209: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 tmp[100]; data/ries-2018.08.05/ries.c:4218: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 tmp[100]; char fmt[FMT_STR_SIZE]; data/ries-2018.08.05/ries.c:4218:18: [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[100]; char fmt[FMT_STR_SIZE]; data/ries-2018.08.05/ries.c:4291: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. char tmp[100]; data/ries-2018.08.05/ries.c:4332: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). in = fopen(filename, "rb"); data/ries-2018.08.05/ries.c:4344: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). in = fopen(name_ext, "rb"); data/ries-2018.08.05/ries.c:5948: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 st_a[F_ALLOC*2]; /* subterm A */ data/ries-2018.08.05/ries.c:5950: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 st_b[F_ALLOC*2]; /* subterm B */ data/ries-2018.08.05/ries.c:6492:29: [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. ries_strncpy(output+j, (char *) (sym_attrs[c].sa_name), (int)l2); data/ries-2018.08.05/ries.c:6518: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 cv_scratch[EXPR_ALLOC]; data/ries-2018.08.05/ries.c:6685: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 fscratch[F_ALLOC]; data/ries-2018.08.05/ries.c:6686: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 gscratch[MAX_ELEN * MAX_SYM_NAME_LEN]; data/ries-2018.08.05/ries.c:6769: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. char fscratch[F_ALLOC]; data/ries-2018.08.05/ries.c:6770: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. char gscratch[MAX_ELEN * MAX_SYM_NAME_LEN]; data/ries-2018.08.05/ries.c:7474: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 pfw_buf[40]; data/ries-2018.08.05/ries.c:7478: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 fmt1[FMT_STR_SIZE]; data/ries-2018.08.05/ries.c:7479: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 fmt2[FMT_STR_SIZE]; data/ries-2018.08.05/ries.c:7826: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 fval[REPORT_FIELD_SIZE]; /* formatted numerical value (before manual left-justify) */ data/ries-2018.08.05/ries.c:7827: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 froot[FROOT_SIZE]; /* formatted root of equation (value of X, not delta from T) */ data/ries-2018.08.05/ries.c:7834: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 l_fscratch[F_ALLOC]; char r_fscratch[F_ALLOC * 2]; data/ries-2018.08.05/ries.c:7834:38: [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 l_fscratch[F_ALLOC]; char r_fscratch[F_ALLOC * 2]; data/ries-2018.08.05/ries.c:7835: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 l_gscratch[MAX_ELEN * MAX_SYM_NAME_LEN]; data/ries-2018.08.05/ries.c:7836: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 r_gscratch[MAX_ELEN * MAX_SYM_NAME_LEN * 2]; /* *2 for try.solve */ data/ries-2018.08.05/ries.c:8139:7: [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 temp[REPORT_FIELD_SIZE]; data/ries-2018.08.05/ries.c:9894:7: [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. const char * seft_names[3] = { data/ries-2018.08.05/ries.c:10942: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 * * stk_argv[MAX_FILE_DEPTH]; data/ries-2018.08.05/ries.c:10975:15: [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 (f = fopen(pdp+2,"r"), f) { data/ries-2018.08.05/ries.c:10981:15: [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 (f = fopen(pdp+2,"r"), f) { data/ries-2018.08.05/ries.c:11627:20: [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 argtmp[20]; data/ries-2018.08.05/ries.c:12255: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 fmt1[FMT_STR_SIZE]; data/ries-2018.08.05/ries.c:4340: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). t_len = strlen(filename) + 6; /* + ".ries\0" */ data/ries-2018.08.05/ries.c:6486: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). l = (s16) strlen(input); data/ries-2018.08.05/ries.c:6491: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). l2 = strlen(sym_attrs[c].sa_name); data/ries-2018.08.05/ries.c:6694: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). for(j=((int)strlen(gscratch)); j<justify; j++) { data/ries-2018.08.05/ries.c:6784:20: [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(j=(s16)strlen(gscratch); j<27; j++) { data/ries-2018.08.05/ries.c:7408:24: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). sl = (s16) strlen(sym_attrs[sym].defn); data/ries-2018.08.05/ries.c:7412:28: [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). clen = (s16) strlen(candidate); data/ries-2018.08.05/ries.c:7964: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). l_fmt = (char *) l_escratch; lf_len = (s16) strlen(l_fmt); data/ries-2018.08.05/ries.c:7970:42: [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). l_fmt = l_fscratch; lf_len = (s16) strlen(l_fmt); data/ries-2018.08.05/ries.c:7987: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). r_fmt = (char *) r_escratch; rf_len = (s16) strlen(r_fmt); data/ries-2018.08.05/ries.c:8008:42: [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). r_fmt = r_fscratch; rf_len = (s16) strlen(r_fmt); data/ries-2018.08.05/ries.c:8104:23: [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). posn = (s16) (8 + strlen(fval)); data/ries-2018.08.05/ries.c:8110: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). posn = (s16)(6 + strlen(x_T_intro) + strlen(fval) ); data/ries-2018.08.05/ries.c:8110:42: [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). posn = (s16)(6 + strlen(x_T_intro) + strlen(fval) ); data/ries-2018.08.05/ries.c:8115: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). posn = (s16)(6 + strlen(x_T_intro) + strlen(fval) ); data/ries-2018.08.05/ries.c:8115:42: [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). posn = (s16)(6 + strlen(x_T_intro) + strlen(fval) ); data/ries-2018.08.05/ries.c:9780: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). if(strlen(sym_attrs[sym].defn) > LINELEFT_INIT) { data/ries-2018.08.05/ries.c:9788: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). if ((sym_attrs[sym].sa_name==0) || (strlen(sym_attrs[sym].sa_name) == 0)) { data/ries-2018.08.05/ries.c:10704: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). slen = strlen(str); data/ries-2018.08.05/ries.c:10969:28: [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). plen = sizeof(char) * (strlen(hd) + 100); data/ries-2018.08.05/ries.c:11595: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 (strlen(a+3) <= MAX_SYM_NAME_LEN) { ANALYSIS SUMMARY: Hits = 79 Lines analyzed = 12515 in approximately 0.44 seconds (28234 lines/second) Physical Source Lines of Code (SLOC) = 6655 Hits@level = [0] 549 [1] 21 [2] 38 [3] 2 [4] 18 [5] 0 Hits@level+ = [0+] 628 [1+] 79 [2+] 58 [3+] 20 [4+] 18 [5+] 0 Hits/KSLOC@level+ = [0+] 94.3651 [1+] 11.8708 [2+] 8.71525 [3+] 3.00526 [4+] 2.70473 [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.