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-mapdata-2.3.0/src/Gmake.c Examining data/r-cran-mapdata-2.3.0/src/Lmake.c Examining data/r-cran-mapdata-2.3.0/src/map.h FINAL RESULTS: data/r-cran-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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-mapdata-2.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 = 25 Lines analyzed = 551 in approximately 0.05 seconds (10473 lines/second) Physical Source Lines of Code (SLOC) = 476 Hits@level = [0] 14 [1] 6 [2] 15 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 39 [1+] 25 [2+] 19 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 81.9328 [1+] 52.521 [2+] 39.916 [3+] 8.40336 [4+] 8.40336 [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.