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-ncdf4-1.17/src/ncdf.c FINAL RESULTS: data/r-cran-ncdf4-1.17/src/ncdf.c:784:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(dimname[0], name); data/r-cran-ncdf4-1.17/src/ncdf.c:2277:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf( errmess, "the passed variable name [%s] does not exist in the file!", data/r-cran-ncdf4-1.17/src/ncdf.c:403: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 vn[2048]; data/r-cran-ncdf4-1.17/src/ncdf.c:537: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 vn[2048]; data/r-cran-ncdf4-1.17/src/ncdf.c:659: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 vn[2048]; data/r-cran-ncdf4-1.17/src/ncdf.c:769: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 name[NC_MAX_NAME]; data/r-cran-ncdf4-1.17/src/ncdf.c:1167: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 varname[MAX_NC_NAME]; data/r-cran-ncdf4-1.17/src/ncdf.c:1957: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 gname[MAX_NC_NAME]; data/r-cran-ncdf4-1.17/src/ncdf.c:2071: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 varname[MAX_NC_NAME]; data/r-cran-ncdf4-1.17/src/ncdf.c:2268: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 errmess[1024]; data/r-cran-ncdf4-1.17/src/ncdf.c:2499: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 dimname[MAX_NC_NAME]; data/r-cran-ncdf4-1.17/src/ncdf.c:698:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( data[i], tempstore[0]+i*slen, slen ); data/r-cran-ncdf4-1.17/src/ncdf.c:1014: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). attlen = strlen(attribute[0]); data/r-cran-ncdf4-1.17/src/ncdf.c:1085:3: [1] (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). Risk is low because the source is a constant character. strcpy( attribute[0], "\0" ); data/r-cran-ncdf4-1.17/src/ncdf.c:1090:3: [1] (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). Risk is low because the source is a constant character. strcpy( attribute[0], "\0" ); data/r-cran-ncdf4-1.17/src/ncdf.c:1143: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( strings[i] ); data/r-cran-ncdf4-1.17/src/ncdf.c:1145:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tstr, strings[i], slen); data/r-cran-ncdf4-1.17/src/ncdf.c:1356: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). slen2use = ((slen < strlen(data[i])) ? slen : strlen(data[i])); data/r-cran-ncdf4-1.17/src/ncdf.c:1356:50: [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). slen2use = ((slen < strlen(data[i])) ? slen : strlen(data[i])); data/r-cran-ncdf4-1.17/src/ncdf.c:1385: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). slen2use = ((slen < strlen(data[stridx])) ? slen : strlen(data[stridx])); data/r-cran-ncdf4-1.17/src/ncdf.c:1385:55: [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). slen2use = ((slen < strlen(data[stridx])) ? slen : strlen(data[stridx])); data/r-cran-ncdf4-1.17/src/ncdf.c:1420: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). slen2use = ((slen < strlen(data[stridx])) ? slen : strlen(data[stridx])); data/r-cran-ncdf4-1.17/src/ncdf.c:1420:55: [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). slen2use = ((slen < strlen(data[stridx])) ? slen : strlen(data[stridx])); data/r-cran-ncdf4-1.17/src/ncdf.c:1942: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). for( i=0; i<strlen(s); i++ ) { data/r-cran-ncdf4-1.17/src/ncdf.c:1986:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy( gname, varname, idx_first_slash ); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 2623 in approximately 0.09 seconds (28620 lines/second) Physical Source Lines of Code (SLOC) = 1778 Hits@level = [0] 0 [1] 14 [2] 9 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 25 [1+] 25 [2+] 11 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 14.0607 [1+] 14.0607 [2+] 6.18673 [3+] 1.12486 [4+] 1.12486 [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.