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/sysbench-1.0.20+ds/src/sb_logger.c Examining data/sysbench-1.0.20+ds/src/sb_util.h Examining data/sysbench-1.0.20+ds/src/sb_lua.c Examining data/sysbench-1.0.20+ds/src/sb_win.h Examining data/sysbench-1.0.20+ds/src/sb_win.c Examining data/sysbench-1.0.20+ds/src/sb_timer.h Examining data/sysbench-1.0.20+ds/src/sb_barrier.c Examining data/sysbench-1.0.20+ds/src/sb_rand.c Examining data/sysbench-1.0.20+ds/src/sb_counter.c Examining data/sysbench-1.0.20+ds/src/drivers/drizzle/drv_drizzle.c Examining data/sysbench-1.0.20+ds/src/drivers/pgsql/drv_pgsql.c Examining data/sysbench-1.0.20+ds/src/drivers/attachsql/drv_attachsql.c Examining data/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c Examining data/sysbench-1.0.20+ds/src/drivers/mysql/drv_mysql.c Examining data/sysbench-1.0.20+ds/src/sb_timer.c Examining data/sysbench-1.0.20+ds/src/sysbench.c Examining data/sysbench-1.0.20+ds/src/sb_barrier.h Examining data/sysbench-1.0.20+ds/src/xoroshiro128plus.h Examining data/sysbench-1.0.20+ds/src/sb_list.h Examining data/sysbench-1.0.20+ds/src/sb_global.h Examining data/sysbench-1.0.20+ds/src/sb_histogram.c Examining data/sysbench-1.0.20+ds/src/sb_lua.h Examining data/sysbench-1.0.20+ds/src/sb_thread.c Examining data/sysbench-1.0.20+ds/src/sb_options.c Examining data/sysbench-1.0.20+ds/src/sb_logger.h Examining data/sysbench-1.0.20+ds/src/sb_thread.h Examining data/sysbench-1.0.20+ds/src/sb_ck_pr.h Examining data/sysbench-1.0.20+ds/src/sb_util.c Examining data/sysbench-1.0.20+ds/src/sb_counter.h Examining data/sysbench-1.0.20+ds/src/db_driver.h Examining data/sysbench-1.0.20+ds/src/sb_rand.h Examining data/sysbench-1.0.20+ds/src/tests/sb_memory.h Examining data/sysbench-1.0.20+ds/src/tests/mutex/sb_mutex.c Examining data/sysbench-1.0.20+ds/src/tests/sb_cpu.h Examining data/sysbench-1.0.20+ds/src/tests/sb_fileio.h Examining data/sysbench-1.0.20+ds/src/tests/sb_mutex.h Examining data/sysbench-1.0.20+ds/src/tests/memory/sb_memory.c Examining data/sysbench-1.0.20+ds/src/tests/fileio/crc32tbl.h Examining data/sysbench-1.0.20+ds/src/tests/fileio/crc32.c Examining data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c Examining data/sysbench-1.0.20+ds/src/tests/fileio/crc32.h Examining data/sysbench-1.0.20+ds/src/tests/threads/sb_threads.c Examining data/sysbench-1.0.20+ds/src/tests/sb_threads.h Examining data/sysbench-1.0.20+ds/src/tests/cpu/sb_cpu.c Examining data/sysbench-1.0.20+ds/src/sb_options.h Examining data/sysbench-1.0.20+ds/src/sb_histogram.h Examining data/sysbench-1.0.20+ds/src/sysbench.h Examining data/sysbench-1.0.20+ds/src/db_driver.c FINAL RESULTS: data/sysbench-1.0.20+ds/src/db_driver.c:870:3: [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(con->bulk_buffer, query); data/sysbench-1.0.20+ds/src/db_driver.c:922: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(con->bulk_buffer + con->bulk_ptr + 1, query); data/sysbench-1.0.20+ds/src/db_driver.c:925: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(con->bulk_buffer + con->bulk_ptr, query); data/sysbench-1.0.20+ds/src/sb_logger.c:281:7: [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. n = vsnprintf(buf + clen, maxlen, fmt, ap); data/sysbench-1.0.20+ds/src/sb_logger.c:333:7: [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. n = vsnprintf(buf + clen, maxlen, fmt, ap); data/sysbench-1.0.20+ds/src/sb_logger.c:400:7: [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. n = vsnprintf(buf, TEXT_BUFFER_SIZE, fmt, ap); data/sysbench-1.0.20+ds/src/sb_logger.h:133:23: [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. SB_ATTRIBUTE_FORMAT(printf, 2, 3); data/sysbench-1.0.20+ds/src/sb_logger.h:142:23: [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. SB_ATTRIBUTE_FORMAT(printf, 3, 4); data/sysbench-1.0.20+ds/src/sb_logger.h:147:23: [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. SB_ATTRIBUTE_FORMAT(printf, 2, 3); data/sysbench-1.0.20+ds/src/sb_lua.c:581: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. const char *home = getenv("HOME"); data/sysbench-1.0.20+ds/src/sb_lua.c:601: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. const char *path = getenv("LUA_PATH"); data/sysbench-1.0.20+ds/src/sb_lua.c:627:10: [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. path = getenv("LUA_CPATH"); data/sysbench-1.0.20+ds/src/sb_rand.c:158:20: [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. rand_unique_seed(random(), random()); data/sysbench-1.0.20+ds/src/sb_rand.c:158:30: [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. rand_unique_seed(random(), random()); data/sysbench-1.0.20+ds/src/sb_rand.c:181:34: [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. sb_rng_state[0] = (((uint64_t) random()) << 32) | data/sysbench-1.0.20+ds/src/sb_rand.c:182:18: [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. (((uint64_t) random()) & UINT32_MAX); data/sysbench-1.0.20+ds/src/sb_rand.c:183:34: [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. sb_rng_state[1] = (((uint64_t) random()) << 32) | data/sysbench-1.0.20+ds/src/sb_rand.c:184:18: [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. (((uint64_t) random()) & UINT32_MAX); data/sysbench-1.0.20+ds/src/sb_win.c:34:3: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(&cond->lock_waiting); data/sysbench-1.0.20+ds/src/sb_win.c:99:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&cond->lock_waiting); data/sysbench-1.0.20+ds/src/sb_win.c:107:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&cond->lock_waiting); data/sysbench-1.0.20+ds/src/sb_win.c:123:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/sysbench-1.0.20+ds/src/sb_win.c:130:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&cond->lock_waiting); data/sysbench-1.0.20+ds/src/sb_win.c:143:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(&cond->lock_waiting); data/sysbench-1.0.20+ds/src/sb_win.c:170:3: [3] (misc) InitializeCriticalSection: Exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. InitializeCriticalSection(mutex); data/sysbench-1.0.20+ds/src/sb_win.c:175:3: [3] (misc) EnterCriticalSection: On some versions of Windows, exceptions can be thrown in low-memory situations. Use InitializeCriticalSectionAndSpinCount instead. EnterCriticalSection(mutex); data/sysbench-1.0.20+ds/src/sb_win.c:282:5: [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. int random() data/sysbench-1.0.20+ds/src/sb_win.h:25:9: [3] (random) srandom: 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. #define srandom(seed) srand(seed) data/sysbench-1.0.20+ds/src/sb_win.h:25:23: [3] (random) srand: 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. #define srandom(seed) srand(seed) data/sysbench-1.0.20+ds/src/sb_win.h:98:12: [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. extern int random(); data/sysbench-1.0.20+ds/src/sysbench.c:662:5: [3] (random) srandom: 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. srandom(sb_rand_seed); data/sysbench-1.0.20+ds/src/sysbench.c:668:5: [3] (random) srandom: 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. srandom(time(NULL)); data/sysbench-1.0.20+ds/src/db_driver.h:233: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 pad[SB_CACHELINE_PAD(sizeof(db_error_t) + data/sysbench-1.0.20+ds/src/drivers/attachsql/drv_attachsql.c:314:3: [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(stmt->bound_param, params, len * sizeof(db_bind_t)); data/sysbench-1.0.20+ds/src/drivers/drizzle/drv_drizzle.c:327:3: [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(stmt->bound_param, params, len * sizeof(db_bind_t)); data/sysbench-1.0.20+ds/src/drivers/mysql/drv_mysql.c:399:7: [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). atoi(SB_LIST_ENTRY(ports_pos, value_t, listitem)->data); data/sysbench-1.0.20+ds/src/drivers/mysql/drv_mysql.c:632:3: [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(stmt->bound_param, params, len * sizeof(db_bind_t)); data/sysbench-1.0.20+ds/src/drivers/mysql/drv_mysql.c:736:26: [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). tmp = (unsigned int) atoi(val); data/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c:565:3: [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(stmt->bound_param, params, len * sizeof(db_bind_t)); data/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c:902:7: [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(row->data[i].value, column->value, column->len); data/sysbench-1.0.20+ds/src/drivers/pgsql/drv_pgsql.c:291: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[32]; data/sysbench-1.0.20+ds/src/drivers/pgsql/drv_pgsql.c:407:3: [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(stmt->bound_param, params, len * sizeof(db_bind_t)); data/sysbench-1.0.20+ds/src/drivers/pgsql/drv_pgsql.c:610:11: [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(pgstmt->pvalues[i], stmt->bound_param[i].buffer, data/sysbench-1.0.20+ds/src/sb_logger.c:65:8: [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 text_buf[TEXT_BUFFER_SIZE]; data/sysbench-1.0.20+ds/src/sb_logger.c:273: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 buf[TEXT_BUFFER_SIZE]; data/sysbench-1.0.20+ds/src/sb_logger.c:321: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 buf[TEXT_BUFFER_SIZE]; data/sysbench-1.0.20+ds/src/sb_logger.c:368: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 buf[TEXT_BUFFER_SIZE]; data/sysbench-1.0.20+ds/src/sb_logger.c: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 errbuf[ERROR_BUFFER_SIZE]; data/sysbench-1.0.20+ds/src/sb_options.c:121: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 *fp = fopen(filename, "r"); data/sysbench-1.0.20+ds/src/sb_options.c:679: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 buf[MAXSTRLEN]; data/sysbench-1.0.20+ds/src/sb_timer.c:66:3: [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(to, from, sizeof(sb_timer_t)); data/sysbench-1.0.20+ds/src/sb_timer.c:105:3: [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(old, t, sizeof(*old)); data/sysbench-1.0.20+ds/src/sb_timer.h:98: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 pad[SB_CACHELINE_PAD(sizeof(struct timespec)*2 + sizeof(uint64_t)*5 + data/sysbench-1.0.20+ds/src/sb_util.h:101:13: [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 cta[(expr) ? 1 : -1] SB_ATTRIBUTE_UNUSED; \ data/sysbench-1.0.20+ds/src/sysbench.c:632: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 list_str[MAX_CHECKPOINTS * 12]; data/sysbench-1.0.20+ds/src/sysbench.c:1406:3: [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(sb_globals.argv, argv, argc * sizeof(char *)); data/sysbench-1.0.20+ds/src/tests/fileio/crc32.c:146: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). out = fopen("crc32.h", "w"); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:344: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 file_name[512]; data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:381: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. char ss1[16], ss2[16]; data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:731: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 sizestr[16]; data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:965: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 file_name[512]; data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:988:10: [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). fd = open(file_name, O_CREAT | O_WRONLY | flags, S_IRUSR | S_IWUSR); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1055: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 file_name[512]; data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1232:3: [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(&oper->iocb, iocb, sizeof(*iocb)); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1649:5: [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(buf, (char *)start + page_offset, count); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1658:5: [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(buf, (char *)mmaps[file_id] + offset, count); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1658:18: [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. memcpy(buf, (char *)mmaps[file_id] + offset, count); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1710:5: [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((char *)start + page_offset, buf, count); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1720:5: [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((char *)mmaps[file_id] + offset, buf, count); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1720:13: [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. memcpy((char *)mmaps[file_id] + offset, buf, count); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:1994:10: [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). file = open(name, O_RDWR | flags, S_IRUSR | S_IWUSR); data/sysbench-1.0.20+ds/src/tests/fileio/sb_fileio.c:2023:10: [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). file = open(path, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); data/sysbench-1.0.20+ds/src/tests/mutex/sb_mutex.c:38: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 pad[256]; data/sysbench-1.0.20+ds/src/drivers/drizzle/drv_drizzle.c:446: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). strlen(query), query); data/sysbench-1.0.20+ds/src/drivers/mysql/drv_mysql.c:694:5: [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/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c:308:65: [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). rc = OCIServerAttach(ora_con->srvhp, ora_con->errhp, args.db, strlen(args.db), data/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c:319:19: [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). strlen(args.user), OCI_ATTR_USERNAME, ora_con->errhp); data/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c:324:19: [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). strlen(args.password), OCI_ATTR_PASSWORD, ora_con->errhp); data/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c:838:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(column->name, fnamep, col_len + 1); data/sysbench-1.0.20+ds/src/drivers/oracle/drv_oracle.c:1021:16: [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). *len = strlen(param->buffer); data/sysbench-1.0.20+ds/src/sb_logger.c:394:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(errbuf, strerror(old_errno), sizeof(errbuf)); data/sysbench-1.0.20+ds/src/sb_logger.c:468:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(text_buf, text_msg->text, TEXT_BUFFER_SIZE); data/sysbench-1.0.20+ds/src/sb_lua.c:1226:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(param->buf, str, length); data/sysbench-1.0.20+ds/src/sb_options.c:202: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). len = strlen(opts[i].name); data/sysbench-1.0.20+ds/src/sb_options.c:204:7: [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). strlen(opt_formats[opts[i].type]) : 8 /* =UNKNOWN */; data/sysbench-1.0.20+ds/src/sb_options.c:217: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)(maxlen - strlen(opts[i].name) + 1), fmt, data/sysbench-1.0.20+ds/src/sb_util.c:53:9: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. buf = memalign(alignment, size); data/sysbench-1.0.20+ds/src/sb_win.h:102:22: [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. static __inline int usleep(int micros) ANALYSIS SUMMARY: Hits = 88 Lines analyzed = 17847 in approximately 0.41 seconds (43124 lines/second) Physical Source Lines of Code (SLOC) = 12267 Hits@level = [0] 74 [1] 15 [2] 41 [3] 23 [4] 9 [5] 0 Hits@level+ = [0+] 162 [1+] 88 [2+] 73 [3+] 32 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 13.2062 [1+] 7.17372 [2+] 5.95093 [3+] 2.60862 [4+] 0.733676 [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.