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/python-gmpy2-2.1.0~b5/gmpy2/gmpy2.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_abs.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_abs.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_add.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_add.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_binary.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_binary.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_cache.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_cache.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_cmp.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_cmp.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_const.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_const.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_context.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_context.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_gmp.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_gmp.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpfr.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpfr.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_utils.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_utils.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_divmod.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_divmod.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_floordiv.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_floordiv.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_format.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_fused.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_fused.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_hash.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_hash.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_macros.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_math.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_math.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_minus.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_minus.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_misc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_misc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mod.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mod.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpc_misc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpc_misc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpfr.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpfr.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpfr_misc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpfr_misc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpmath.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpq.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpq.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpq_misc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpq_misc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_bitops.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_bitops.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_divmod.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_divmod.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_divmod2exp.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_divmod2exp.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_inplace.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_inplace.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_misc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_misc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_pack.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mpz_pack.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mul.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_mul.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_muldiv_2exp.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_muldiv_2exp.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_plus.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_plus.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_pow.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_pow.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_predicate.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_predicate.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_random.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_random.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_richcompare.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_richcompare.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_sign.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_sign.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_square.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_square.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_sub.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_sub.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_truediv.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_truediv.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_types.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_vector.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_vector.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz_inplace.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz_inplace.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz_limbs.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz_limbs.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz_misc.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy2_xmpz_misc.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy_mpz_lucas.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy_mpz_lucas.h Examining data/python-gmpy2-2.1.0~b5/src/gmpy_mpz_prp.c Examining data/python-gmpy2-2.1.0~b5/src/gmpy_mpz_prp.h Examining data/python-gmpy2-2.1.0~b5/src/mpz_pylong.c FINAL RESULTS: data/python-gmpy2-2.1.0~b5/src/gmpy2_convert.c:206:13: [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(p, _xztag); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert.c:208:13: [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(p, _ztag); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_gmp.c:922:9: [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(p, _qtag); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:332:9: [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(newbuf, buffer); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:585: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(tempbuf, realbuf); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:604: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(tempbuf, imagbuf); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_gmp.c:646:20: [2] (integer) atol: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). expt = atol(whereexp+1); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_gmp.c:896: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 buffer[50], *p; data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.c:634: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 fmtstr[60]; data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.c:640:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fmtstr, "{0:.%ld.%ldg}", rprec, iprec); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.c:656: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 fmtstr[60]; data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.c:663:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fmtstr, "mpc('{0:.%ld.%ldg}',(%ld,%ld))", data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.c:666:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fmtstr, "mpc('{0:.%ld.%ldg}')", rprec, iprec); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpfr.c:930: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 fmtstr[60]; data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpfr.c:934:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fmtstr, "{0:.%ldg}", precision); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpfr.c:949: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 fmtstr[60]; data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpfr.c:955:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fmtstr, "mpfr('{0:.%ldg}',%ld)", precision, bits); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpfr.c:957:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(fmtstr, "mpfr('{0:.%ldg}')", precision); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:65: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 fmt[30]; data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:207: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 mpfrfmt[100], fmt[30]; data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:333:9: [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(newbuf, ".0"); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:386: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 rfmt[100], ifmt[100], fmt[30]; data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:591:9: [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(tempbuf, ".0"); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:607:9: [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(tempbuf, ".0"); data/python-gmpy2-2.1.0~b5/src/mpz_pylong.c:33:10: [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 data/python-gmpy2-2.1.0~b5/src/gmpy2_convert.c:209: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). p += strlen(p); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert.c:241: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). p = buffer + strlen(buffer); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_gmp.c:923: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). p += strlen(p); data/python-gmpy2-2.1.0~b5/src/gmpy2_convert_mpc.c:318: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). if ((Py_ssize_t)strlen(cp) != len) { data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:325: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(buffer) == strspn(buffer, "+- 0123456789")) { data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:584:9: [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(tempbuf, "("); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:589: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(realbuf) < 50 && data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:590: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). strlen(realbuf) == strspn(realbuf, "+- 0123456789")) { data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:595:9: [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(tempbuf, " "); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:601:13: [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(tempbuf, "+"); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:605: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(imagbuf) < 50 && data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:606: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). strlen(imagbuf) == strspn(imagbuf, "+- 0123456789")) { data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:611:9: [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(tempbuf, ")"); data/python-gmpy2-2.1.0~b5/src/gmpy2_format.c:613:9: [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(tempbuf, "j"); ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 36695 in approximately 0.94 seconds (38951 lines/second) Physical Source Lines of Code (SLOC) = 25340 Hits@level = [0] 0 [1] 14 [2] 19 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 39 [1+] 39 [2+] 25 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 1.53907 [1+] 1.53907 [2+] 0.986582 [3+] 0.23678 [4+] 0.23678 [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.