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/pcsc-tools-1.5.7/pcsc_scan.c FINAL RESULTS: data/pcsc-tools-1.5.7/pcsc_scan.c:800:6: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(atr_command, ATR_PARSER " '%s'", atr); data/pcsc-tools-1.5.7/pcsc_scan.c:801:10: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system(atr_command)) data/pcsc-tools-1.5.7/pcsc_scan.c:133:21: [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. const char *term = getenv("TERM"); data/pcsc-tools-1.5.7/pcsc_scan.c:263:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((opt = getopt(argc, argv, OPTIONS)) != EOF) data/pcsc-tools-1.5.7/pcsc_scan.c:64: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 buffer[1024]; data/pcsc-tools-1.5.7/pcsc_scan.c:429: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 atr[MAX_ATR_SIZE*3+1]; /* ATR in ASCII */ data/pcsc-tools-1.5.7/pcsc_scan.c:430: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 atr_command[sizeof(atr)+sizeof(ATR_PARSER)+2+1]; data/pcsc-tools-1.5.7/pcsc_scan.c:783:7: [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(&atr[j*3], "%02X ", data/pcsc-tools-1.5.7/pcsc_scan.c:529: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). ptr += strlen(ptr)+1; data/pcsc-tools-1.5.7/pcsc_scan.c:598: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). ptr += strlen(ptr)+1; ANALYSIS SUMMARY: Hits = 10 Lines analyzed = 851 in approximately 0.04 seconds (23614 lines/second) Physical Source Lines of Code (SLOC) = 664 Hits@level = [0] 50 [1] 2 [2] 4 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 60 [1+] 10 [2+] 8 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 90.3614 [1+] 15.0602 [2+] 12.0482 [3+] 6.0241 [4+] 3.01205 [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.