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/libgdal-grass-3.2.0/ogrgrass.h Examining data/libgdal-grass-3.2.0/ogrgrassdriver.cpp Examining data/libgdal-grass-3.2.0/ogrgrassdatasource.cpp Examining data/libgdal-grass-3.2.0/grass.cpp Examining data/libgdal-grass-3.2.0/ogrgrasslayer.cpp FINAL RESULTS: data/libgdal-grass-3.2.0/grass.cpp:861:11: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ( !getenv( "GISBASE" ) ) { data/libgdal-grass-3.2.0/ogrgrassdatasource.cpp:151:11: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ( !getenv( "GISBASE" ) ) { data/libgdal-grass-3.2.0/ogrgrasslayer.cpp:201:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ( getenv("GISBASE") ) // We have some projection info in GISBASE data/libgdal-grass-3.2.0/grass.cpp:271:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((void *) &sOpenWindow, (void *) &(poDSIn->sCellInfo), sizeof(struct Cell_head)); data/libgdal-grass-3.2.0/grass.cpp:330: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. char key[200], value[200]; data/libgdal-grass-3.2.0/grass.cpp:420:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy((void *) &sOpenWindow, (void *) sNewWindow, sizeof(struct Cell_head)); data/libgdal-grass-3.2.0/grass.cpp:769:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy( padfGeoTransform, adfGeoTransform, sizeof(double) * 6 ); data/libgdal-grass-3.2.0/grass.cpp:787: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 *ptr[5]; data/libgdal-grass-3.2.0/grass.cpp:866: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. char buf[2000]; data/libgdal-grass-3.2.0/ogrgrassdatasource.cpp:156: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. char buf[2000]; data/libgdal-grass-3.2.0/ogrgrassdatasource.cpp:251: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 *p, *ptr[5], *tmp; data/libgdal-grass-3.2.0/ogrgrasslayer.cpp:66: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. char buf[20]; data/libgdal-grass-3.2.0/ogrgrasslayer.cpp:549: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 buf[2000]; data/libgdal-grass-3.2.0/ogrgrasslayer.cpp:808: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. char buf[2000]; data/libgdal-grass-3.2.0/grass.cpp:797:19: [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 ( !path || strlen(path) == 0 ) data/libgdal-grass-3.2.0/grass.cpp:805: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). if ( strlen(p+1) == 0 ) /* repeated '/' */ data/libgdal-grass-3.2.0/ogrgrassdatasource.cpp:258:19: [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 ( !path || strlen(path) == 0 ) data/libgdal-grass-3.2.0/ogrgrassdatasource.cpp:266: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). if ( strlen(p+1) == 0 ) /* repeated '/' */ ANALYSIS SUMMARY: Hits = 18 Lines analyzed = 2645 in approximately 0.18 seconds (14529 lines/second) Physical Source Lines of Code (SLOC) = 1704 Hits@level = [0] 10 [1] 4 [2] 11 [3] 3 [4] 0 [5] 0 Hits@level+ = [0+] 28 [1+] 18 [2+] 14 [3+] 3 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 16.4319 [1+] 10.5634 [2+] 8.21596 [3+] 1.76056 [4+] 0 [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.