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/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc Examining data/libgdsii-0.2+ds.1/lib/Flatten.cc Examining data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc Examining data/libgdsii-0.2+ds.1/lib/libGDSII.cc Examining data/libgdsii-0.2+ds.1/lib/libGDSII.h FINAL RESULTS: data/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc:45:6: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buffer,1000,ErrorMessage,ap); data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:671:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(Name,"%12s",RecordTypes[Record.RType].Name); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:255:3: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buffer,MAXSTR,format,ap); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:284:3: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buffer,MAXSTR,format,ap); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:299:3: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buffer,MAXSTR,format,ap); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:314:3: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buffer,MAXSTR,format,ap); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:322:6: [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 + NS, buffer); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:333:3: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(buffer,MAXSTR,format,ap); data/libgdsii-0.2+ds.1/lib/Flatten.cc:304:14: [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. char *s=getenv("LIBGDSII_LENGTH_UNIT"); data/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc:44:6: [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 buffer[1000]; data/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc:283:14: [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). FILE *f=fopen(PortFileName,"w"); data/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc:344: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). FILE *f=fopen("/proc/self/status","r"); data/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc:346:6: [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 Line[MAXSTR]; data/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc:367: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). FILE *f=fopen("/proc/self/statm","r"); data/libgdsii-0.2+ds.1/applications/GDSIIConvert.cc:370:6: [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 Line[MAXSTR]; data/libgdsii-0.2+ds.1/lib/Flatten.cc:102: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 Label[1000]; data/libgdsii-0.2+ds.1/lib/Flatten.cc:125: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 Label[1000]; data/libgdsii-0.2+ds.1/lib/Flatten.cc:179: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 Label[1000]; data/libgdsii-0.2+ds.1/lib/Flatten.cc:332:27: [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). ppFile = *pppFile = fopen(ppFileName,"w"); data/libgdsii-0.2+ds.1/lib/Flatten.cc:340:29: [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). geoFile = *pgeoFile = fopen(geoFileName,"w"); data/libgdsii-0.2+ds.1/lib/Flatten.cc:369: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 ppFileName[100]; data/libgdsii-0.2+ds.1/lib/Flatten.cc:373: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 geoFileName[100]; data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:543: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 RawString[33]; data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:670: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 Name[15]; data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:740: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). FILE *f=fopen(FileName.c_str(),"r"); data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:801:39: [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). FILE *f = (FileName == 0 ? stdout : fopen(FileName,"w") ); data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:854: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). FILE *f=fopen(GDSIIFileName,"r"); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:254: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 buffer[MAXSTR]; data/libgdsii-0.2+ds.1/lib/libGDSII.cc:264:6: [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). f=fopen(LogFileName,"a"); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:271: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 TimeString[30]; data/libgdsii-0.2+ds.1/lib/libGDSII.cc:281: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 buffer[MAXSTR]; data/libgdsii-0.2+ds.1/lib/libGDSII.cc:296: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 buffer[MAXSTR]; data/libgdsii-0.2+ds.1/lib/libGDSII.cc:311: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 buffer[MAXSTR]; data/libgdsii-0.2+ds.1/lib/libGDSII.cc:330: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 buffer[MAXSTR]; data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:544:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(RawString, Original, Size); data/libgdsii-0.2+ds.1/lib/ReadGDSIIFile.cc:546: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). int L = strlen(RawString); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:320: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). { int NS=strlen(s), NB=strlen(buffer); data/libgdsii-0.2+ds.1/lib/libGDSII.cc:320: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). { int NS=strlen(s), NB=strlen(buffer); ANALYSIS SUMMARY: Hits = 38 Lines analyzed = 2328 in approximately 0.12 seconds (20066 lines/second) Physical Source Lines of Code (SLOC) = 1622 Hits@level = [0] 90 [1] 4 [2] 25 [3] 1 [4] 8 [5] 0 Hits@level+ = [0+] 128 [1+] 38 [2+] 34 [3+] 9 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 78.9149 [1+] 23.4279 [2+] 20.9618 [3+] 5.54871 [4+] 4.93218 [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.