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-maps-3.3.0/src/Gmake.c Examining data/r-cran-maps-3.3.0/src/mapclip.c Examining data/r-cran-maps-3.3.0/src/mapget.c Examining data/r-cran-maps-3.3.0/src/Lmake.c Examining data/r-cran-maps-3.3.0/src/map.h Examining data/r-cran-maps-3.3.0/src/init.c Examining data/r-cran-maps-3.3.0/src/thin.c Examining data/r-cran-maps-3.3.0/src/smooth.c FINAL RESULTS: data/r-cran-maps-3.3.0/src/Gmake.c:30:2: [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(stderr, s, a, b); data/r-cran-maps-3.3.0/src/Gmake.c:40:2: [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(stderr, s, a, b); data/r-cran-maps-3.3.0/src/Lmake.c:30:2: [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(stderr, s, a, b); data/r-cran-maps-3.3.0/src/Lmake.c:40:2: [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(stderr, s, a, b); data/r-cran-maps-3.3.0/src/mapget.c:138:3: [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(s, data); data/r-cran-maps-3.3.0/src/mapget.c:139: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(s, suffix); data/r-cran-maps-3.3.0/src/Gmake.c:61:7: [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). *r = atoi(w); data/r-cran-maps-3.3.0/src/Gmake.c:69: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. static char word[WORDSIZE]; data/r-cran-maps-3.3.0/src/Gmake.c:135: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[128]; data/r-cran-maps-3.3.0/src/Gmake.c:160:4: [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", (int)r[j]); data/r-cran-maps-3.3.0/src/Gmake.c:226:11: [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((in = fopen(av[2], "rb")) == NULL) data/r-cran-maps-3.3.0/src/Gmake.c:228: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((in2 = fopen(av[3], "rb")) == NULL) data/r-cran-maps-3.3.0/src/Gmake.c:233: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((out = fopen(av[4], "wb")) == NULL) data/r-cran-maps-3.3.0/src/Gmake.c:236:22: [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(!ascii && (Lin = fopen(av[5], "rb")) == NULL) data/r-cran-maps-3.3.0/src/Lmake.c:76: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. static char word[WORDSIZE]; data/r-cran-maps-3.3.0/src/Lmake.c:126: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[128]; data/r-cran-maps-3.3.0/src/Lmake.c:158:4: [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, " %.*f %.*f", Precision, xy[j].x, Precision, xy[j].y); data/r-cran-maps-3.3.0/src/Lmake.c:234:14: [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). Precision = atoi(av[1]); data/r-cran-maps-3.3.0/src/Lmake.c:237:11: [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((in = fopen(av[4], "rb")) == NULL) data/r-cran-maps-3.3.0/src/Lmake.c:239: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((in2 = fopen(av[5], "rb")) == NULL) data/r-cran-maps-3.3.0/src/Lmake.c:244:19: [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((out = fopen(av[6], "wb")) == NULL) data/r-cran-maps-3.3.0/src/mapget.c:152: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 Lname[512]; data/r-cran-maps-3.3.0/src/mapget.c:157: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((lf = fopen(Lname, "rb")) == NULL) data/r-cran-maps-3.3.0/src/mapget.c:202: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[512]; data/r-cran-maps-3.3.0/src/mapget.c:221:11: [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((rf = fopen(Gname, "rb")) == NULL) data/r-cran-maps-3.3.0/src/mapget.c:305: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 Lname[512]; data/r-cran-maps-3.3.0/src/mapget.c:324:11: [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((lf = fopen(Lname, "rb")) == NULL) data/r-cran-maps-3.3.0/src/mapget.c:548: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 Gname[512]; data/r-cran-maps-3.3.0/src/mapget.c:558: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((rf = fopen(Gname, "rb")) == NULL) data/r-cran-maps-3.3.0/src/Gmake.c:74:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if((c = fgetc(f)) < 0) data/r-cran-maps-3.3.0/src/Gmake.c:81:7: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = fgetc(f); data/r-cran-maps-3.3.0/src/Gmake.c:161: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). k = strlen(buf); data/r-cran-maps-3.3.0/src/Lmake.c:81:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if((c = fgetc(f)) < 0) data/r-cran-maps-3.3.0/src/Lmake.c:89:7: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = fgetc(f); data/r-cran-maps-3.3.0/src/Lmake.c:159: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). k = strlen(buf); ANALYSIS SUMMARY: Hits = 35 Lines analyzed = 2033 in approximately 0.09 seconds (23383 lines/second) Physical Source Lines of Code (SLOC) = 1611 Hits@level = [0] 15 [1] 6 [2] 23 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 50 [1+] 35 [2+] 29 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 31.0366 [1+] 21.7256 [2+] 18.0012 [3+] 3.72439 [4+] 3.72439 [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.