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/xylib-1.3/xylib/cpi.cpp Examining data/xylib-1.3/xylib/xfit_xdd.h Examining data/xylib-1.3/xylib/canberra_cnf.h Examining data/xylib-1.3/xylib/dbws.cpp Examining data/xylib-1.3/xylib/text.cpp Examining data/xylib-1.3/xylib/canberra_mca.h Examining data/xylib-1.3/xylib/csv.h Examining data/xylib-1.3/xylib/philips_udf.h Examining data/xylib-1.3/xylib/xylib.h Examining data/xylib-1.3/xylib/rigaku_dat.cpp Examining data/xylib-1.3/xylib/util.h Examining data/xylib-1.3/xylib/cache.cpp Examining data/xylib-1.3/xylib/cpi.h Examining data/xylib-1.3/xylib/specsxy.h Examining data/xylib-1.3/xylib/csv.cpp Examining data/xylib-1.3/xylib/uxd.cpp Examining data/xylib-1.3/xylib/philips_raw.h Examining data/xylib-1.3/xylib/riet7.h Examining data/xylib-1.3/xylib/vamas.h Examining data/xylib-1.3/xylib/gsas.h Examining data/xylib-1.3/xylib/brucker_raw.h Examining data/xylib-1.3/xylib/philips_raw.cpp Examining data/xylib-1.3/xylib/pdcif.cpp Examining data/xylib-1.3/xylib/xylib.cpp Examining data/xylib-1.3/xylib/util.cpp Examining data/xylib-1.3/xylib/chiplot.h Examining data/xylib-1.3/xylib/canberra_mca.cpp Examining data/xylib-1.3/xylib/riet7.cpp Examining data/xylib-1.3/xylib/brucker_raw.cpp Examining data/xylib-1.3/xylib/spectra.h Examining data/xylib-1.3/xylib/pdcif.h Examining data/xylib-1.3/xylib/rigaku_dat.h Examining data/xylib-1.3/xylib/chiplot.cpp Examining data/xylib-1.3/xylib/xfit_xdd.cpp Examining data/xylib-1.3/xylib/text.h Examining data/xylib-1.3/xylib/canberra_cnf.cpp Examining data/xylib-1.3/xylib/specsxy.cpp Examining data/xylib-1.3/xylib/dbws.h Examining data/xylib-1.3/xylib/vamas.cpp Examining data/xylib-1.3/xylib/uxd.h Examining data/xylib-1.3/xylib/spectra.cpp Examining data/xylib-1.3/xylib/winspec_spe.cpp Examining data/xylib-1.3/xylib/gsas.cpp Examining data/xylib-1.3/xylib/winspec_spe.h Examining data/xylib-1.3/xylib/philips_udf.cpp Examining data/xylib-1.3/xylib/cache.h Examining data/xylib-1.3/xyconv.cpp FINAL RESULTS: data/xylib-1.3/xylib/util.h:72:5: [4] (format) _snprintf: 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. _snprintf(buffer, N, fmt, t); data/xylib-1.3/xylib/util.h:74:5: [4] (format) snprintf: 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. snprintf(buffer, N, fmt, t); data/xylib-1.3/xyconv.cpp:128:13: [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(fname.c_str(), "w"); data/xylib-1.3/xylib/canberra_cnf.cpp:39: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[48]; data/xylib-1.3/xylib/canberra_cnf.cpp:113: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 s[64]; data/xylib-1.3/xylib/csv.cpp:89: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 buffer[1600]; // more than enough for one line data/xylib-1.3/xylib/riet7.cpp:35: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 line[256]; data/xylib-1.3/xylib/spectra.cpp:29: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 line[256]; data/xylib-1.3/xylib/spectra.cpp:65: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 line[256]; data/xylib-1.3/xylib/util.cpp:112:12: [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 buf[256]; data/xylib-1.3/xylib/util.cpp:262: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 line[256]; data/xylib-1.3/xylib/util.h:70: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 buffer[N]; data/xylib-1.3/xylib/xylib.cpp:104:12: [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 ver[16]; data/xylib-1.3/xylib/xylib.cpp:106:9: [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(ver, "%d.%d.%d", XYLIB_VERSION / 10000, data/xylib-1.3/xyconv.cpp:92:30: [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). bool has_exts = (strlen(fi->exts) != 0); data/xylib-1.3/xylib/canberra_cnf.cpp:41:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(buf, 48); data/xylib-1.3/xylib/canberra_cnf.cpp:54:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(buf, 48); data/xylib-1.3/xylib/canberra_mca.cpp:35:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(all_data, file_size); data/xylib-1.3/xylib/canberra_mca.cpp:56:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(all_data, file_size); data/xylib-1.3/xylib/specsxy.cpp:219:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while(read){ data/xylib-1.3/xylib/util.cpp:66:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(buf, len); data/xylib-1.3/xylib/winspec_spe.cpp:174:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(&calib.calib_valid, 1); data/xylib-1.3/xylib/winspec_spe.cpp:177:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). f.read(&calib.polynom_order, 1); data/xylib-1.3/xylib/xylib.cpp:601:22: [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). size_t len = strlen(exts); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 6550 in approximately 0.17 seconds (38668 lines/second) Physical Source Lines of Code (SLOC) = 4648 Hits@level = [0] 19 [1] 10 [2] 12 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 43 [1+] 24 [2+] 14 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 9.25129 [1+] 5.16351 [2+] 3.01205 [3+] 0.430293 [4+] 0.430293 [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.