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/librandom123-1.09+dfsg/include/Random123/conventional/Engine.hpp Examining data/librandom123-1.09+dfsg/include/Random123/conventional/gsl_cbrng.h Examining data/librandom123-1.09+dfsg/include/Random123/aes.h Examining data/librandom123-1.09+dfsg/include/Random123/ars.h Examining data/librandom123-1.09+dfsg/include/Random123/features/msvcfeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/features/open64features.h Examining data/librandom123-1.09+dfsg/include/Random123/features/nvccfeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/features/iccfeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/features/sunprofeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/features/sse.h Examining data/librandom123-1.09+dfsg/include/Random123/features/openclfeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/features/compilerfeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/features/clangfeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/features/gccfeatures.h Examining data/librandom123-1.09+dfsg/include/Random123/MicroURNG.hpp Examining data/librandom123-1.09+dfsg/include/Random123/philox.h Examining data/librandom123-1.09+dfsg/include/Random123/array.h Examining data/librandom123-1.09+dfsg/include/Random123/ReinterpretCtr.hpp Examining data/librandom123-1.09+dfsg/include/Random123/gsl_microrng.h Examining data/librandom123-1.09+dfsg/include/Random123/threefry.h Examining data/librandom123-1.09+dfsg/examples/ut_ars.c Examining data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp Examining data/librandom123-1.09+dfsg/examples/kat_dev_execute.h Examining data/librandom123-1.09+dfsg/examples/uniform.hpp Examining data/librandom123-1.09+dfsg/examples/time_random123.h Examining data/librandom123-1.09+dfsg/examples/pi_capi.c Examining data/librandom123-1.09+dfsg/examples/ut_uniform_IEEEkat.cpp Examining data/librandom123-1.09+dfsg/examples/kat_opencl.c Examining data/librandom123-1.09+dfsg/examples/util_opencl.h Examining data/librandom123-1.09+dfsg/examples/ut_carray.cpp Examining data/librandom123-1.09+dfsg/examples/time_serial.c Examining data/librandom123-1.09+dfsg/examples/simple.c Examining data/librandom123-1.09+dfsg/examples/ut_features.cpp Examining data/librandom123-1.09+dfsg/examples/util_cpu.h Examining data/librandom123-1.09+dfsg/examples/time_misc.h Examining data/librandom123-1.09+dfsg/examples/u01fixedpt.h Examining data/librandom123-1.09+dfsg/examples/pi_check.h Examining data/librandom123-1.09+dfsg/examples/boxmuller.hpp Examining data/librandom123-1.09+dfsg/examples/ut_uniform_IEEEkatvectors.hpp Examining data/librandom123-1.09+dfsg/examples/time_thread.c Examining data/librandom123-1.09+dfsg/examples/util_demangle.hpp Examining data/librandom123-1.09+dfsg/examples/simplepp.cpp Examining data/librandom123-1.09+dfsg/examples/pi_uniform.cpp Examining data/librandom123-1.09+dfsg/examples/kat_main.h Examining data/librandom123-1.09+dfsg/examples/util_print.h Examining data/librandom123-1.09+dfsg/examples/time_initkeyctr.h Examining data/librandom123-1.09+dfsg/examples/rngNxW.h Examining data/librandom123-1.09+dfsg/examples/util.h Examining data/librandom123-1.09+dfsg/examples/timers.cpp Examining data/librandom123-1.09+dfsg/examples/util_cuda.h Examining data/librandom123-1.09+dfsg/examples/util_m128.h Examining data/librandom123-1.09+dfsg/examples/time_opencl.c Examining data/librandom123-1.09+dfsg/examples/ut_ReinterpretCtr.cpp Examining data/librandom123-1.09+dfsg/examples/pi_cppapi.cpp Examining data/librandom123-1.09+dfsg/examples/ut_aes.cpp Examining data/librandom123-1.09+dfsg/examples/kat_c.c Examining data/librandom123-1.09+dfsg/examples/ut_uniform_reference.hpp Examining data/librandom123-1.09+dfsg/examples/ut_gsl.c Examining data/librandom123-1.09+dfsg/examples/pi_opencl.c Examining data/librandom123-1.09+dfsg/examples/ut_uniform.cpp Examining data/librandom123-1.09+dfsg/examples/pi_gsl.c Examining data/librandom123-1.09+dfsg/examples/pi_microurng.cpp Examining data/librandom123-1.09+dfsg/examples/util_expandtpl.h Examining data/librandom123-1.09+dfsg/examples/kat.h Examining data/librandom123-1.09+dfsg/examples/pi_aes.cpp Examining data/librandom123-1.09+dfsg/examples/ut_M128.cpp Examining data/librandom123-1.09+dfsg/examples/ut_Engine.cpp Examining data/librandom123-1.09+dfsg/examples/ua.hpp Examining data/librandom123-1.09+dfsg/examples/kat_cpp.cpp Examining data/librandom123-1.09+dfsg/examples/ut_ua.cpp FINAL RESULTS: data/librandom123-1.09+dfsg/examples/kat_main.h:143:5: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(line, "%s%n", name, &nchar); data/librandom123-1.09+dfsg/examples/kat_main.h:165:2: [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. fprintf(stderr, #base #N "x" #W " %d", ti->nrounds); \ data/librandom123-1.09+dfsg/examples/kat_main.h:178:2: [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. fprintf(stderr, #base #N "x" #W " %d", ti->nrounds); \ data/librandom123-1.09+dfsg/examples/kat_main.h:231:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "%s/kat_vectors", e); data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:71:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fname, "%s-%s", out_fname, tname); data/librandom123-1.09+dfsg/examples/util.h:118:5: [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(p, s); data/librandom123-1.09+dfsg/examples/util.h:188:26: [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. void prtu32(uint32_t v){ fprintf(stderr, "%08" PRIx32, v); } data/librandom123-1.09+dfsg/examples/util.h:189:26: [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. void prtu64(uint64_t v){ fprintf(stderr, "%016" PRIx64, v); } data/librandom123-1.09+dfsg/examples/util.h:235:49: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define dprintf(x) do { if (debug < 1) ; else { printf x; fflush(stdout); } } while (0) data/librandom123-1.09+dfsg/examples/util.h:255:8: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. ret = sscanf(cp, xfmt, &xv, &xj); \ data/librandom123-1.09+dfsg/examples/util.h:275:2: [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. fprintf(fp, ofmt, (unsigned long long) ARR.v[xj]); \ data/librandom123-1.09+dfsg/examples/util_cpu.h:78:16: [4] (shell) popen: 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. FILE *fp = popen("sysctl hw.cpufrequency", "r"); data/librandom123-1.09+dfsg/examples/util_cpu.h:90:16: [4] (shell) popen: 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. FILE *fp = popen("kstat -p -s current_clock_Hz", "r"); data/librandom123-1.09+dfsg/examples/util_cpu.h:148:16: [4] (shell) popen: 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. FILE *fp = popen("sysctl hw.ncpu hw.clockrate hw.model", "r"); data/librandom123-1.09+dfsg/examples/kat_main.h:228:25: [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 *e = getenv("srcdir"); data/librandom123-1.09+dfsg/examples/kat_main.h:245: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. if ((p = getenv("KATC_VERBOSE")) != NULL) { data/librandom123-1.09+dfsg/examples/kat_main.h:248: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. if ((p = getenv("KATC_DEBUG")) != NULL) { data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:113: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. dumpfname = getenv("BOXMULLER_DUMPFILE"); data/librandom123-1.09+dfsg/examples/time_opencl.c:176: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. if ((cp = getenv("TIME_OPENCL_VERBOSE")) != NULL) { data/librandom123-1.09+dfsg/examples/time_opencl.c:179: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. if ((cp = getenv("TIME_OPENCL_DEBUG")) != NULL) { data/librandom123-1.09+dfsg/examples/time_opencl.c:182: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. if ((cp = getenv("TIME_OPENCL_OFFSET")) != NULL) { data/librandom123-1.09+dfsg/examples/time_opencl.c:185: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. if ((cp = getenv("TIME_OPENCL_NUMTRIALS")) != NULL) { data/librandom123-1.09+dfsg/examples/time_opencl.c:188: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. if ((cp = getenv("TIME_OPENCL_SEC_PER_TRIAL")) != NULL) { data/librandom123-1.09+dfsg/examples/time_opencl.c:191: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. if ((cp = getenv("TIME_OPENCL_BUILD_OPTIONS")) == NULL) { data/librandom123-1.09+dfsg/examples/time_serial.c:133: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. if ((cp = getenv("TIME_SERIAL_VERBOSE")) != NULL) { data/librandom123-1.09+dfsg/examples/time_serial.c:136: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. if ((cp = getenv("TIME_SERIAL_DEBUG")) != NULL) { data/librandom123-1.09+dfsg/examples/time_serial.c:139: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. if ((cp = getenv("TIME_SERIAL_OFFSET")) != NULL) { data/librandom123-1.09+dfsg/examples/time_serial.c:142: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. if ((cp = getenv("TIME_SERIAL_NUMTRIALS")) != NULL) { data/librandom123-1.09+dfsg/examples/time_serial.c:145: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. if ((cp = getenv("TIME_SERIAL_SEC_PER_TRIAL")) != NULL) { data/librandom123-1.09+dfsg/examples/time_thread.c:221: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. if ((cp = getenv("TIME_THREAD_VERBOSE")) != NULL) { data/librandom123-1.09+dfsg/examples/time_thread.c:224: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. if ((cp = getenv("TIME_THREAD_DEBUG")) != NULL) { data/librandom123-1.09+dfsg/examples/time_thread.c:227: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. if ((cp = getenv("TIME_THREAD_OFFSET")) != NULL) { data/librandom123-1.09+dfsg/examples/time_thread.c:230: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. if ((cp = getenv("TIME_THREAD_NUMTRIALS")) != NULL) { data/librandom123-1.09+dfsg/examples/time_thread.c:233: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. if ((cp = getenv("TIME_THREAD_SEC_PER_TRIAL")) != NULL) { data/librandom123-1.09+dfsg/examples/timers.cpp:189: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. if((envp = getenv("TIMERS_COUNTER"))){ data/librandom123-1.09+dfsg/examples/timers.cpp:195: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. if( (envp = getenv("TIMERS_KEY"))){ data/librandom123-1.09+dfsg/examples/util_opencl.h:314:22: [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 ((clbinfile = getenv("R123_SAVE_OPENCL_BINARY")) != NULL) { data/librandom123-1.09+dfsg/include/Random123/features/clangfeatures.h:72:44: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. #if __cplusplus>=201103L && __has_include(<random>) data/librandom123-1.09+dfsg/examples/kat_cpp.cpp:170: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(&ti->u, &data, sizeof(data)); data/librandom123-1.09+dfsg/examples/kat_main.h:82:7: [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. const char *unknown_names[MAXUNKNOWNS]; data/librandom123-1.09+dfsg/examples/kat_main.h:141: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 name[LINESIZE]; data/librandom123-1.09+dfsg/examples/kat_main.h:214: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 linebuf[LINESIZE]; data/librandom123-1.09+dfsg/examples/kat_main.h:218: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 filename[LINESIZE]; data/librandom123-1.09+dfsg/examples/kat_main.h:238: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). inpfile = fopen(inname, "r"); data/librandom123-1.09+dfsg/examples/kat_main.h:246: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). verbose = atoi(p); data/librandom123-1.09+dfsg/examples/kat_main.h:249:10: [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). debug = atoi(p); data/librandom123-1.09+dfsg/examples/pi_opencl.c:51:33: [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). unsigned count = argc > 1 ? atoi(argv[1]) : 0; data/librandom123-1.09+dfsg/examples/pi_opencl.c:63:34: [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). verbose = debug = argc > 2 ? atoi(argv[2]): 0; data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:72:7: [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). fp = fopen(fname, "w"); data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:119:16: [2] (integer) atol: 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). Ntry = atol(argv[1]); data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:122:14: [2] (integer) atol: 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). keyf.v[i] = atol(argv[2+i]); data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:125:14: [2] (integer) atol: 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). keyd.v[i] = atol(argv[2+i]); data/librandom123-1.09+dfsg/examples/time_opencl.c:175:10: [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). count = atoi(argv[1]); data/librandom123-1.09+dfsg/examples/time_opencl.c:177: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). verbose = atoi(cp); data/librandom123-1.09+dfsg/examples/time_opencl.c:180:10: [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). debug = atoi(cp); data/librandom123-1.09+dfsg/examples/time_opencl.c:183: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). keyctroffset = atoi(cp); data/librandom123-1.09+dfsg/examples/time_opencl.c:186: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). numtrials = atoi(cp); data/librandom123-1.09+dfsg/examples/time_serial.c:132:10: [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). count = atoi(argv[1]); data/librandom123-1.09+dfsg/examples/time_serial.c:134: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). verbose = atoi(cp); data/librandom123-1.09+dfsg/examples/time_serial.c:137:10: [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). debug = atoi(cp); data/librandom123-1.09+dfsg/examples/time_serial.c:140: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). keyctroffset = atoi(cp); data/librandom123-1.09+dfsg/examples/time_serial.c:143: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). numtrials = atoi(cp); data/librandom123-1.09+dfsg/examples/time_thread.c:220:10: [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). count = atoi(argv[1]); data/librandom123-1.09+dfsg/examples/time_thread.c:222: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). verbose = atoi(cp); data/librandom123-1.09+dfsg/examples/time_thread.c:225:10: [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). debug = atoi(cp); data/librandom123-1.09+dfsg/examples/time_thread.c:228: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). keyctroffset = atoi(cp); data/librandom123-1.09+dfsg/examples/time_thread.c:231: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). numtrials = atoi(cp); data/librandom123-1.09+dfsg/examples/ut_ars.c:51: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 m128str[M128_STR_SIZE], *kat; data/librandom123-1.09+dfsg/examples/ut_uniform_IEEEkat.cpp:187: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 astr[32]; data/librandom123-1.09+dfsg/examples/ut_uniform_IEEEkat.cpp:188:5: [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(astr, "%d", a); data/librandom123-1.09+dfsg/examples/util.h:215: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). exponent = atoi(s); data/librandom123-1.09+dfsg/examples/util.h:270: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 ofmt[64]; \ data/librandom123-1.09+dfsg/examples/util.h:273:5: [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(ofmt, " %%0%lullx", (unsigned long)sizeof(ARR.v[0])*2UL); \ data/librandom123-1.09+dfsg/examples/util_cpu.h:105: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, buf[1024]; /* long enough for any /proc/cpuinfo line */ data/librandom123-1.09+dfsg/examples/util_cpu.h:111:15: [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). if ((fp = fopen("/proc/cpuinfo", "r")) == NULL) { data/librandom123-1.09+dfsg/examples/util_cpu.h:124:6: [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(*modelnamep, s, i); data/librandom123-1.09+dfsg/examples/util_cpu.h:154: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 buf[256]; data/librandom123-1.09+dfsg/examples/util_cpu.h:184:10: [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 n = atoi(arg); data/librandom123-1.09+dfsg/examples/util_m128.h:57:11: [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. unsigned char bytes[16]; data/librandom123-1.09+dfsg/examples/util_m128.h:61:5: [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(hex, "%02x%02x%02x%02x" "%02x%02x%02x%02x" data/librandom123-1.09+dfsg/examples/util_m128.h:80: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 hex[M128_STR_SIZE]; data/librandom123-1.09+dfsg/examples/util_opencl.h:60: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 vendor[UCL_STRSIZE], devname[UCL_STRSIZE], data/librandom123-1.09+dfsg/examples/util_opencl.h:152:11: [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. const char *srcstr[2], *clbinfile; data/librandom123-1.09+dfsg/examples/util_opencl.h:303: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 errbuf[512*1024]; data/librandom123-1.09+dfsg/examples/util_opencl.h:326:24: [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). CHECKNOTZERO(fp = fopen(clbinfile, "wc")); data/librandom123-1.09+dfsg/include/Random123/ReinterpretCtr.hpp:80:14: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(&bc, &c, sizeof(c)); data/librandom123-1.09+dfsg/include/Random123/ReinterpretCtr.hpp:83:14: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. std::memcpy(&c, &bc, sizeof(bc)); data/librandom123-1.09+dfsg/include/Random123/features/clangfeatures.h:56: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. typedef char static_assertion[(!!(expr))*2-1] \ data/librandom123-1.09+dfsg/include/Random123/features/compilerfeatures.h:270:47: [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. #define R123_STATIC_ASSERT(expr, msg) typedef char static_assertion[(!!(expr))*2-1] data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:69:26: [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). fname = (char *) malloc(strlen(out_fname) + strlen(tname) + 2); data/librandom123-1.09+dfsg/examples/time_boxmuller.cpp:69:46: [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). fname = (char *) malloc(strlen(out_fname) + strlen(tname) + 2); data/librandom123-1.09+dfsg/examples/util.h:76:38: [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). char *cp = s, *cp2, *cpend = s + strlen(s); data/librandom123-1.09+dfsg/examples/util.h:117: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). char *p = (char *)malloc(strlen(s)+1); ANALYSIS SUMMARY: Hits = 93 Lines analyzed = 14176 in approximately 1.19 seconds (11927 lines/second) Physical Source Lines of Code (SLOC) = 9262 Hits@level = [0] 138 [1] 4 [2] 51 [3] 24 [4] 14 [5] 0 Hits@level+ = [0+] 231 [1+] 93 [2+] 89 [3+] 38 [4+] 14 [5+] 0 Hits/KSLOC@level+ = [0+] 24.9406 [1+] 10.041 [2+] 9.60916 [3+] 4.10279 [4+] 1.51155 [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.