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/lhasa-0.3.1/doc/intro.h Examining data/lhasa-0.3.1/lib/bit_stream_reader.c Examining data/lhasa-0.3.1/lib/crc16.c Examining data/lhasa-0.3.1/lib/crc16.h Examining data/lhasa-0.3.1/lib/ext_header.c Examining data/lhasa-0.3.1/lib/ext_header.h Examining data/lhasa-0.3.1/lib/lh1_decoder.c Examining data/lhasa-0.3.1/lib/lh5_decoder.c Examining data/lhasa-0.3.1/lib/lh6_decoder.c Examining data/lhasa-0.3.1/lib/lh7_decoder.c Examining data/lhasa-0.3.1/lib/lh_new_decoder.c Examining data/lhasa-0.3.1/lib/lha_arch.h Examining data/lhasa-0.3.1/lib/lha_arch_unix.c Examining data/lhasa-0.3.1/lib/lha_arch_win32.c Examining data/lhasa-0.3.1/lib/lha_basic_reader.c Examining data/lhasa-0.3.1/lib/lha_basic_reader.h Examining data/lhasa-0.3.1/lib/lha_decoder.c Examining data/lhasa-0.3.1/lib/lha_decoder.h Examining data/lhasa-0.3.1/lib/lha_endian.c Examining data/lhasa-0.3.1/lib/lha_endian.h Examining data/lhasa-0.3.1/lib/lha_file_header.c Examining data/lhasa-0.3.1/lib/lha_file_header.h Examining data/lhasa-0.3.1/lib/lha_input_stream.c Examining data/lhasa-0.3.1/lib/lha_input_stream.h Examining data/lhasa-0.3.1/lib/lha_reader.c Examining data/lhasa-0.3.1/lib/lhx_decoder.c Examining data/lhasa-0.3.1/lib/lz5_decoder.c Examining data/lhasa-0.3.1/lib/lzs_decoder.c Examining data/lhasa-0.3.1/lib/macbinary.c Examining data/lhasa-0.3.1/lib/macbinary.h Examining data/lhasa-0.3.1/lib/null_decoder.c Examining data/lhasa-0.3.1/lib/pm1_decoder.c Examining data/lhasa-0.3.1/lib/pm2_decoder.c Examining data/lhasa-0.3.1/lib/pma_common.c Examining data/lhasa-0.3.1/lib/public/lha_decoder.h Examining data/lhasa-0.3.1/lib/public/lha_file_header.h Examining data/lhasa-0.3.1/lib/public/lha_input_stream.h Examining data/lhasa-0.3.1/lib/public/lha_reader.h Examining data/lhasa-0.3.1/lib/public/lhasa.h Examining data/lhasa-0.3.1/lib/tree_decode.c Examining data/lhasa-0.3.1/src/extract.c Examining data/lhasa-0.3.1/src/extract.h Examining data/lhasa-0.3.1/src/filter.c Examining data/lhasa-0.3.1/src/filter.h Examining data/lhasa-0.3.1/src/list.c Examining data/lhasa-0.3.1/src/list.h Examining data/lhasa-0.3.1/src/main.c Examining data/lhasa-0.3.1/src/options.h Examining data/lhasa-0.3.1/src/safe.c Examining data/lhasa-0.3.1/src/safe.h Examining data/lhasa-0.3.1/test/build-arch.c Examining data/lhasa-0.3.1/test/crc32.c Examining data/lhasa-0.3.1/test/crc32.h Examining data/lhasa-0.3.1/test/decompress-crc.c Examining data/lhasa-0.3.1/test/dump-headers.c Examining data/lhasa-0.3.1/test/fuzzer.c Examining data/lhasa-0.3.1/test/ghost-tester.c Examining data/lhasa-0.3.1/test/test-basic-reader.c Examining data/lhasa-0.3.1/test/test-crc16.c Examining data/lhasa-0.3.1/test/test-decoder.c FINAL RESULTS: data/lhasa-0.3.1/lib/lha_arch_unix.c:61:9: [5] (race) chown: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchown( ) instead. return chown(filename, unix_uid, unix_gid) == 0; data/lhasa-0.3.1/lib/lha_arch_unix.c:66:9: [5] (race) chmod: This accepts filename arguments; if an attacker can move those files, a race condition results. (CWE-362). Use fchmod( ) instead. return chmod(filename, unix_perms) == 0; data/lhasa-0.3.1/lib/lha_arch_win32.c:44: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. len = vsnprintf(NULL, 0, fmt, args); data/lhasa-0.3.1/lib/lha_arch_win32.c:48:11: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. return vsprintf(*result, fmt, args); data/lhasa-0.3.1/lib/lha_file_header.c:81:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(result, "%s%s", path, filename); data/lhasa-0.3.1/src/extract.c:78:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(result, options->extract_path); data/lhasa-0.3.1/src/extract.c:94:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(result, p); data/lhasa-0.3.1/src/extract.c:106:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(result, p); data/lhasa-0.3.1/src/filter.c:104:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(path, header->path); data/lhasa-0.3.1/src/filter.c:108:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(path, header->filename); data/lhasa-0.3.1/src/main.c:44:2: [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. printf( data/lhasa-0.3.1/test/fuzzer.c:79:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(filename, "input-data.%s.%i", algorithm, getpid()); data/lhasa-0.3.1/test/ghost-tester.c:300:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(cmdbuf1, command, filename); data/lhasa-0.3.1/test/ghost-tester.c:301:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cmdbuf2, "dosbox -c 'mount c .' -c 'c:' -c '%s' -c exit", data/lhasa-0.3.1/test/ghost-tester.c:303:2: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. system(cmdbuf2); data/lhasa-0.3.1/src/list.c:294:12: [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. env_val = getenv("TEST_NOW_TIME"); data/lhasa-0.3.1/test/fuzzer.c:321:3: [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. srand(time(NULL)); data/lhasa-0.3.1/test/ghost-tester.c:360:2: [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. srand(time(NULL)); data/lhasa-0.3.1/lib/ext_header.c:134:2: [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(new_filename, data, data_len); data/lhasa-0.3.1/lib/ext_header.c:178:2: [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(new_path, data, data_len); data/lhasa-0.3.1/lib/ext_header.c:288:2: [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(username, data, data_len); data/lhasa-0.3.1/lib/ext_header.c:321:2: [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(group, data, data_len); data/lhasa-0.3.1/lib/lha_arch_unix.c:97:11: [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). fileno = open(filename, O_CREAT|O_WRONLY|O_EXCL, 0600); data/lhasa-0.3.1/lib/lha_arch_win32.c:174: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). return fopen(filename, "wb"); data/lhasa-0.3.1/lib/lha_decoder.c:200: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(buf + filled, decoder->outbuf + decoder->outbuf_pos, data/lhasa-0.3.1/lib/lha_file_header.c:329:2: [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(header->filename, data, data_len); data/lhasa-0.3.1/lib/lha_file_header.c:646:2: [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((*header)->compress_method, &RAW_DATA(header, 2), 5); data/lhasa-0.3.1/lib/lha_file_header.c:737:2: [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((*header)->compress_method, &RAW_DATA(header, 2), 5); data/lhasa-0.3.1/lib/lha_file_header.c:816:2: [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((*header)->compress_method, &RAW_DATA(header, 2), 5); data/lhasa-0.3.1/lib/lha_input_stream.c:221: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(buf, stream->leadin, n); data/lhasa-0.3.1/lib/lha_input_stream.c:383: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). fstream = fopen(filename, "rb"); data/lhasa-0.3.1/lib/macbinary.c:399: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(buf, decoder->mb_header, decoder->mb_header_bytes); data/lhasa-0.3.1/lib/public/lha_file_header.h:168: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 compress_method[6]; data/lhasa-0.3.1/src/extract.c:606: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[512]; data/lhasa-0.3.1/src/main.c:73: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). fstream = fopen(filename, "rb"); data/lhasa-0.3.1/test/fuzzer.c:65: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). fstream = fopen(filename, "wb"); data/lhasa-0.3.1/test/fuzzer.c:76: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 filename[32]; data/lhasa-0.3.1/test/fuzzer.c:109:2: [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(result, &nbytes, sizeof(size_t)); data/lhasa-0.3.1/test/fuzzer.c:110:2: [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(result + sizeof(size_t), canary_block, sizeof(canary_block)); data/lhasa-0.3.1/test/fuzzer.c:112:2: [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(result + sizeof(size_t) + sizeof(canary_block) + nbytes, data/lhasa-0.3.1/test/fuzzer.c:134:2: [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(&nbytes, data - sizeof(size_t) - sizeof(canary_block), data/lhasa-0.3.1/test/fuzzer.c:170:2: [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, input_data + input_pos, 1); data/lhasa-0.3.1/test/fuzzer.c:266: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). fstream = fopen(filename, "rb"); data/lhasa-0.3.1/test/fuzzer.c:299: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 timestr[32]; data/lhasa-0.3.1/test/ghost-tester.c:128:2: [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, callback_data->buf + callback_data->buf_pos, to_copy); data/lhasa-0.3.1/test/ghost-tester.c:268:2: [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 + 2, type, 5); // Compression type data/lhasa-0.3.1/test/ghost-tester.c:274:2: [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 + 22, filename, strlen(filename)); data/lhasa-0.3.1/test/ghost-tester.c:279: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). outfile = fopen(out_filename, "wb"); data/lhasa-0.3.1/test/ghost-tester.c:297: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 cmdbuf1[64]; data/lhasa-0.3.1/test/ghost-tester.c:298: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 cmdbuf2[128]; data/lhasa-0.3.1/test/ghost-tester.c:321: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). fstream = fopen(filename, "rb"); data/lhasa-0.3.1/test/test-crc16.c:132: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(data, test_data[i].data, 16); data/lhasa-0.3.1/test/test-decoder.c:72: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). fstream = fopen(filename, "rb"); data/lhasa-0.3.1/test/test-decoder.c:106:2: [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, state->data + state->pos, result); data/lhasa-0.3.1/lib/lha_decoder.c:217:26: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). = decoder->dtype->read(decoder + 1, data/lhasa-0.3.1/lib/lha_decoder.h:63:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). size_t (*read)(void *extra_data, uint8_t *buf); data/lhasa-0.3.1/lib/lha_file_header.c:75:18: [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). result = malloc(strlen(path) + strlen(filename) + 1); data/lhasa-0.3.1/lib/lha_file_header.c:75:33: [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). result = malloc(strlen(path) + strlen(filename) + 1); data/lhasa-0.3.1/lib/lha_input_stream.c:135:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return stream->type->read(stream->handle, buf, buf_len); data/lhasa-0.3.1/lib/lha_input_stream.c:146:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read; data/lhasa-0.3.1/lib/lha_input_stream.c:158:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read <= 0) { data/lhasa-0.3.1/lib/lha_input_stream.c:162:40: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). stream->leadin_len += (unsigned int) read; data/lhasa-0.3.1/lib/lha_input_stream.c:179: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). strlen(AMIGA_LHASFX_ID))) { data/lhasa-0.3.1/lib/lha_reader.c:286: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(reader->dir_stack->path)) != 0; data/lhasa-0.3.1/lib/lha_reader.c:721:13: [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). result += strlen(header->path); data/lhasa-0.3.1/lib/lha_reader.c:724:13: [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). result += strlen(header->filename); data/lhasa-0.3.1/lib/macbinary.c:235:22: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). || filename_len != strlen(header->filename) data/lhasa-0.3.1/lib/public/lha_input_stream.h:63:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int (*read)(void *handle, void *buf, size_t buf_len); data/lhasa-0.3.1/src/extract.c:57:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += strlen(options->extract_path) + 1; data/lhasa-0.3.1/src/extract.c:61:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += strlen(header->path); data/lhasa-0.3.1/src/extract.c:65:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len += strlen(header->filename); data/lhasa-0.3.1/src/extract.c:79:3: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(result, "/"); data/lhasa-0.3.1/src/extract.c:295:13: [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). p = path + strlen(path) - 1; data/lhasa-0.3.1/src/extract.c:352:7: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getchar(); data/lhasa-0.3.1/src/filter.c:87:15: [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). path_len += strlen(header->path); data/lhasa-0.3.1/src/filter.c:91:15: [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). path_len += strlen(header->filename); data/lhasa-0.3.1/src/list.c:533:10: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen(columns[i]->name); data/lhasa-0.3.1/src/main.c:201:12: [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). arg += strlen(arg) - 1; data/lhasa-0.3.1/test/fuzzer.c:207:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = dtype->read(handle, read_buf); data/lhasa-0.3.1/test/ghost-tester.c:256:51: [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). buf_len = COMPRESSED_DATA_LEN + MIN_HEADER_LEN + strlen(filename); data/lhasa-0.3.1/test/ghost-tester.c:261:45: [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). generate_data(type, buf + MIN_HEADER_LEN + strlen(filename), data/lhasa-0.3.1/test/ghost-tester.c:267:28: [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). buf[0] = MIN_HEADER_LEN + strlen(filename) - 2; // Header length data/lhasa-0.3.1/test/ghost-tester.c:273:12: [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). buf[21] = strlen(filename); // Filename data/lhasa-0.3.1/test/ghost-tester.c:274:29: [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). memcpy(buf + 22, filename, strlen(filename)); data/lhasa-0.3.1/test/ghost-tester.c:275: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). write_uint16(buf + 22 + strlen(filename), crc16); // CRC data/lhasa-0.3.1/test/ghost-tester.c:277:47: [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). MIN_HEADER_LEN + strlen(filename) - 2); ANALYSIS SUMMARY: Hits = 86 Lines analyzed = 13362 in approximately 1.02 seconds (13103 lines/second) Physical Source Lines of Code (SLOC) = 6588 Hits@level = [0] 116 [1] 32 [2] 36 [3] 3 [4] 13 [5] 2 Hits@level+ = [0+] 202 [1+] 86 [2+] 54 [3+] 18 [4+] 15 [5+] 2 Hits/KSLOC@level+ = [0+] 30.6618 [1+] 13.054 [2+] 8.19672 [3+] 2.73224 [4+] 2.27687 [5+] 0.303582 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.