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/fpga-icestorm-0~20190913git0ec00d8/icebram/icebram.cc Examining data/fpga-icestorm-0~20190913git0ec00d8/icecompr/icecompr.cc Examining data/fpga-icestorm-0~20190913git0ec00d8/icecompr/iceuncompr.c Examining data/fpga-icestorm-0~20190913git0ec00d8/icemulti/icemulti.cc Examining data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc Examining data/fpga-icestorm-0~20190913git0ec00d8/icepll/icepll.cc Examining data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c Examining data/fpga-icestorm-0~20190913git0ec00d8/iceprog/mpsse.c Examining data/fpga-icestorm-0~20190913git0ec00d8/iceprog/mpsse.h Examining data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc Examining data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc FINAL RESULTS: data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:45:19: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. ssize_t buflen = readlink("/proc/self/exe", path, sizeof(path)); data/fpga-icestorm-0~20190913git0ec00d8/icemulti/icemulti.cc:31:18: [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. #define log(...) fprintf(stderr, __VA_ARGS__); data/fpga-icestorm-0~20190913git0ec00d8/icemulti/icemulti.cc:32:70: [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. #define error(...) do { fprintf(stderr, "%s: ", program_short_name); fprintf(stderr, __VA_ARGS__); exit(EXIT_FAILURE); } while (0) data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:50:18: [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. #define log(...) fprintf(stderr, __VA_ARGS__); data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:51:43: [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. #define info(...) do { if (log_level > 0) fprintf(stderr, __VA_ARGS__); } while (0) data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:52:44: [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. #define debug(...) do { if (log_level > 1) fprintf(stderr, __VA_ARGS__); } while (0) data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:53:25: [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. #define error(...) do { fprintf(stderr, "Error: " __VA_ARGS__); exit(1); } while (0) data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:54:30: [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. #define panic(fmt, ...) do { fprintf(stderr, "Internal Error at %s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); abort(); } while (0) data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:67:8: [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. rc = vsnprintf(str, sz, fmt, apc); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:149:8: [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. rc = vsnprintf(str, sz, fmt, apc); data/fpga-icestorm-0~20190913git0ec00d8/icebram/icebram.cc:137: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, "vgs:")) != -1) data/fpga-icestorm-0~20190913git0ec00d8/icecompr/icecompr.cc:214: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, "v")) != -1) data/fpga-icestorm-0~20190913git0ec00d8/icecompr/iceuncompr.c:125: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, "v")) != -1) data/fpga-icestorm-0~20190913git0ec00d8/icemulti/icemulti.cc:220:17: [3] (buffer) getopt_long: 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 ((c = getopt_long(argc, argv, "cp:a:A:o:v", data/fpga-icestorm-0~20190913git0ec00d8/icepll/icepll.cc:94: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, "i:o:Smf:n:q")) != -1) data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:542:16: [3] (buffer) getopt_long: 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_long(argc, argv, "d:I:rR:e:o:cbnStvspX", long_options, NULL)) != -1) { data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2258: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, "p:P:g:o:r:j:d:mitT:Nvc:C:")) != -1) data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:145:7: [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("USERPROFILE") != nullptr) { data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:146:16: [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. homepath += getenv("USERPROFILE"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:149:8: [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("HOMEDRIVE") != nullptr && data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:150:8: [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. getenv("HOMEPATH") != nullptr) { data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:151:17: [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. homepath += getenv("HOMEDRIVE"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:152:17: [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. homepath += getenv("HOMEPATH"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:156:15: [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. homepath += getenv("HOME"); data/fpga-icestorm-0~20190913git0ec00d8/icebram/icebram.cc:149: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). seed_nr = atoi(optarg); data/fpga-icestorm-0~20190913git0ec00d8/icebram/icebram.cc:161:15: [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). int width = atoi(argv[optind]); data/fpga-icestorm-0~20190913git0ec00d8/icebram/icebram.cc:162:15: [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). int depth = atoi(argv[optind+1]); data/fpga-icestorm-0~20190913git0ec00d8/icecompr/icecompr.cc:227:16: [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). input_file = fopen(argv[optind], "rb"); data/fpga-icestorm-0~20190913git0ec00d8/icecompr/icecompr.cc:236:17: [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). output_file = fopen(argv[optind], "wb"); data/fpga-icestorm-0~20190913git0ec00d8/icecompr/iceuncompr.c:137:16: [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). input_file = fopen(argv[optind], "rb"); data/fpga-icestorm-0~20190913git0ec00d8/icecompr/iceuncompr.c:146:17: [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). output_file = fopen(argv[optind], "wb"); data/fpga-icestorm-0~20190913git0ec00d8/icemulti/icemulti.cc:306:13: [2] (misc) open: 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). ofs.open(outfile_name, std::ofstream::binary); data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:1433:7: [2] (misc) open: 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). ifs.open(parameters[0], std::ios::binary); data/fpga-icestorm-0~20190913git0ec00d8/icepack/icepack.cc:1442:7: [2] (misc) open: 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). ofs.open(parameters[1], std::ios::binary); data/fpga-icestorm-0~20190913git0ec00d8/icepll/icepll.cc:30: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[16]; data/fpga-icestorm-0~20190913git0ec00d8/icepll/icepll.cc:265:8: [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(filename, "w"); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:709:47: [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 = (strcmp(filename, "-") == 0) ? stdout : fopen(filename, "wb"); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:716:46: [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 = (strcmp(filename, "-") == 0) ? stdin : fopen(filename, "rb"); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:749:9: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). f = tmpfile(); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:757:22: [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 unsigned char buffer[4096]; data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:834:20: [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 unsigned char buffer[4096]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:204: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, "r"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:210: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 buffer[128]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:241: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 buffer[line_buf_size]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:269: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). tile_x = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:270: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). tile_y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:302:13: [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). int b = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:303:13: [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). int x = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:304:13: [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). int y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:309:15: [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). int net = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:327: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 buffer[1024]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:330: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 *fdb = fopen(buffer, "r"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:368:19: [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). current_net = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:374: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). tile_x = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:375: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). tile_y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:376:19: [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). current_net = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:389: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). tile_x = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:390: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). tile_y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:394:15: [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). cell_z = atoi(z_or_name); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:408:16: [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). int pos_x = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:409:16: [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). int pos_y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:410:16: [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). int pos_z = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:416:17: [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). int tile_x = atoi(tok); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:417:17: [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). int tile_y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:426:20: [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). int other_net = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:437:20: [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). int other_net = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:450:21: [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). items.push_back(atoi(tok)); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:492:12: [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). int b = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:493:12: [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). int x = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:494:12: [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). int y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:503:13: [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). int x = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:504:13: [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). int y = atoi(strtok(nullptr, " \t\r\n")); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:1207: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 lcbits[20]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2271:22: [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). graph_nets.insert(atoi(optarg)); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2277: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). fout = fopen(optarg, "w"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2285: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). frpt = fopen(optarg, "w"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2292: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). fjson = fopen(optarg, "w"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2331:9: [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). fin = fopen(argv[optind], "r"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2474: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). graph_f = fopen("icetime_graph.dot", "w"); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:2550:22: [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). int bit_index = atoi(port.first.substr(open_bracket_pos+1).c_str()); data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:44: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 path[PATH_MAX]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:96: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 longpath[MAX_PATH + 1]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:97: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 shortpath[MAX_PATH + 1]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:100:2: [2] (buffer) TCHAR: 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. TCHAR shortpath[MAX_PATH + 1]; data/fpga-icestorm-0~20190913git0ec00d8/icetime/iceutil.cc:130: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 *fdb = fopen(path.c_str(), "r"); data/fpga-icestorm-0~20190913git0ec00d8/icecompr/icecompr.cc:252:14: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int byte = fgetc(input_file); data/fpga-icestorm-0~20190913git0ec00d8/icecompr/iceuncompr.c:27:17: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_buffer = fgetc(input_file); data/fpga-icestorm-0~20190913git0ec00d8/icemulti/icemulti.cc:68:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ifs.read(reinterpret_cast<char *>(buffer), bufsize); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:277:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:395:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(1000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:788:2: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:795:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(250000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:807:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(250000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:820:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:823:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(2000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:857:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(250000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/iceprog.c:962:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(250000); data/fpga-icestorm-0~20190913git0ec00d8/iceprog/mpsse.c:170:3: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(100); data/fpga-icestorm-0~20190913git0ec00d8/icetime/icetime.cc:246: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 (buffer[strlen(buffer) - 1] != '\n') ANALYSIS SUMMARY: Hits = 99 Lines analyzed = 7226 in approximately 0.29 seconds (24644 lines/second) Physical Source Lines of Code (SLOC) = 5714 Hits@level = [0] 448 [1] 14 [2] 61 [3] 14 [4] 9 [5] 1 Hits@level+ = [0+] 547 [1+] 99 [2+] 85 [3+] 24 [4+] 10 [5+] 1 Hits/KSLOC@level+ = [0+] 95.7298 [1+] 17.3259 [2+] 14.8757 [3+] 4.20021 [4+] 1.75009 [5+] 0.175009 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.