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/r-cran-sp-1.4-4/src/sp.h Examining data/r-cran-sp-1.4-4/src/sp_xports.c Examining data/r-cran-sp-1.4-4/src/gcdist.c Examining data/r-cran-sp-1.4-4/src/init.c Examining data/r-cran-sp-1.4-4/src/pip2.c Examining data/r-cran-sp-1.4-4/src/zerodist.c Examining data/r-cran-sp-1.4-4/src/Rcentroid.c Examining data/r-cran-sp-1.4-4/src/pip.c Examining data/r-cran-sp-1.4-4/src/surfaceArea.c Examining data/r-cran-sp-1.4-4/inst/include/sp.h Examining data/r-cran-sp-1.4-4/inst/include/sp_xports.c FINAL RESULTS: data/r-cran-sp-1.4-4/inst/include/sp_xports.c:585: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(buf, CHAR(STRING_ELT(comment, 0))); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:665: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(buf, cbuf); data/r-cran-sp-1.4-4/src/sp_xports.c:585: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(buf, CHAR(STRING_ELT(comment, 0))); data/r-cran-sp-1.4-4/src/sp_xports.c:665: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(buf, cbuf); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:564: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 s[15], *buf; data/r-cran-sp-1.4-4/inst/include/sp_xports.c:613:12: [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). c[0] = atoi(s); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:619:18: [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). c[i+1] = atoi(s); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:653: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 cbuf[15]; data/r-cran-sp-1.4-4/inst/include/sp_xports.c:660: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(buf, "%d", comm[0]); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:662: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(cbuf, " %d", comm[i]); data/r-cran-sp-1.4-4/src/sp_xports.c:564: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 s[15], *buf; data/r-cran-sp-1.4-4/src/sp_xports.c:613:12: [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). c[0] = atoi(s); data/r-cran-sp-1.4-4/src/sp_xports.c:619:18: [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). c[i+1] = atoi(s); data/r-cran-sp-1.4-4/src/sp_xports.c:653: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 cbuf[15]; data/r-cran-sp-1.4-4/src/sp_xports.c:660: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(buf, "%d", comm[0]); data/r-cran-sp-1.4-4/src/sp_xports.c:662: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(cbuf, " %d", comm[i]); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:593: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). k = (int) strlen(buf); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:610:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, &buf[0], (size_t) nss[0]); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:617:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, &buf[(nss[i]+1)], (size_t) k); data/r-cran-sp-1.4-4/inst/include/sp_xports.c:663: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). if (strlen(buf) + strlen(cbuf) >= bufsiz) data/r-cran-sp-1.4-4/inst/include/sp_xports.c:663: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). if (strlen(buf) + strlen(cbuf) >= bufsiz) data/r-cran-sp-1.4-4/inst/include/sp_xports.c:667:5: [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(buf, "\0"); data/r-cran-sp-1.4-4/src/sp_xports.c:593: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). k = (int) strlen(buf); data/r-cran-sp-1.4-4/src/sp_xports.c:610:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, &buf[0], (size_t) nss[0]); data/r-cran-sp-1.4-4/src/sp_xports.c:617:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, &buf[(nss[i]+1)], (size_t) k); data/r-cran-sp-1.4-4/src/sp_xports.c:663: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). if (strlen(buf) + strlen(cbuf) >= bufsiz) data/r-cran-sp-1.4-4/src/sp_xports.c:663: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). if (strlen(buf) + strlen(cbuf) >= bufsiz) data/r-cran-sp-1.4-4/src/sp_xports.c:667:5: [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(buf, "\0"); ANALYSIS SUMMARY: Hits = 28 Lines analyzed = 2264 in approximately 0.08 seconds (27373 lines/second) Physical Source Lines of Code (SLOC) = 1720 Hits@level = [0] 0 [1] 12 [2] 12 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 28 [1+] 28 [2+] 16 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 16.2791 [1+] 16.2791 [2+] 9.30233 [3+] 2.32558 [4+] 2.32558 [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.