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/libexttextcat-3.4.5/src/createfp.c Examining data/libexttextcat-3.4.5/src/fingerprint.h Examining data/libexttextcat-3.4.5/src/textcat.c Examining data/libexttextcat-3.4.5/src/utf8misc.c Examining data/libexttextcat-3.4.5/src/utf8misc.h Examining data/libexttextcat-3.4.5/src/common.c Examining data/libexttextcat-3.4.5/src/common.h Examining data/libexttextcat-3.4.5/src/wg_mempool.c Examining data/libexttextcat-3.4.5/src/textcat_properties.h Examining data/libexttextcat-3.4.5/src/constants.h Examining data/libexttextcat-3.4.5/src/fingerprint.c Examining data/libexttextcat-3.4.5/src/exttextcat-version.h Examining data/libexttextcat-3.4.5/src/textcat.h Examining data/libexttextcat-3.4.5/src/common_impl.h Examining data/libexttextcat-3.4.5/src/wg_mempool.h Examining data/libexttextcat-3.4.5/src/testtextcat.c FINAL RESULTS: data/libexttextcat-3.4.5/src/fingerprint.c:645:9: [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(h->fprint[i].str, tmp2.str); data/libexttextcat-3.4.5/src/fingerprint.c:693:9: [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(h->fprint[cnt].str, line); data/libexttextcat-3.4.5/src/textcat.c:181:5: [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(finger_print_file_name, prefix); data/libexttextcat-3.4.5/src/textcat.c:234:9: [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(finger_print_file_name, segment[0]); data/libexttextcat-3.4.5/src/fingerprint.c:89:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char str[MAXNGRAMSIZE + 1]; data/libexttextcat-3.4.5/src/fingerprint.c:106: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 str[MAXNGRAMSIZE + 1]; data/libexttextcat-3.4.5/src/fingerprint.c:185:13: [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(&tmp, &heap[parent], sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:186:13: [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(&heap[parent], &heap[child], sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:187:13: [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(&heap[child], &tmp, sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:211:13: [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(&tmp, &heap[parent], sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:212:13: [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(&heap[parent], &heap[child], sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:213:13: [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(&heap[child], &tmp, sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:229: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(&(heap[t->size]), item, sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:242: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(&(heap[0]), item, sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:256: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(item, p, sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:258: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(&(t->heap[0]), &(t->heap[t->size - 1]), sizeof(entry_t)); data/libexttextcat-3.4.5/src/fingerprint.c:435: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 n[MAXNGRAMSIZE + 1]; data/libexttextcat-3.4.5/src/fingerprint.c:500: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 n[MAXNGRAMSIZE + 1]; data/libexttextcat-3.4.5/src/fingerprint.c:661:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[1024]; data/libexttextcat-3.4.5/src/fingerprint.c:664:10: [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, "r"); data/libexttextcat-3.4.5/src/fingerprint.c:716: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(tmp, h->fprint, h->size * sizeof(ngram_t)); data/libexttextcat-3.4.5/src/textcat.c:76: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 output[MAXOUTPUTSIZE]; data/libexttextcat-3.4.5/src/textcat.c:153:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char line[1024]; data/libexttextcat-3.4.5/src/textcat.c:156:10: [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(conffile, "r"); data/libexttextcat-3.4.5/src/textcat.c:186: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. char *segment[4]; data/libexttextcat-3.4.5/src/textcat.c:363:13: [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(&candidates[cnt - 1], &candidates[i], sizeof(candidate_t)); data/libexttextcat-3.4.5/src/createfp.c:107: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). if (fp_Create(h, buf, strlen(buf), 400) == 0) data/libexttextcat-3.4.5/src/fingerprint.c:162:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(entry->str, p, MAXNGRAMSIZE); data/libexttextcat-3.4.5/src/fingerprint.c:688: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). if (strlen(line) > MAXNGRAMSIZE) data/libexttextcat-3.4.5/src/testtextcat.c:115:39: [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 = textcat_Classify(h, buf, strlen(buf) + 1); data/libexttextcat-3.4.5/src/textcat.c:176: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). prefix_size = strlen(prefix); data/libexttextcat-3.4.5/src/textcat.c:216: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). while (prefix_size + strlen(segment[0]) > finger_print_file_name_size) data/libexttextcat-3.4.5/src/wg_mempool.c:196:25: [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). else if (block->p + strlen(str) + 1 >= block->pend) ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 2788 in approximately 0.38 seconds (7360 lines/second) Physical Source Lines of Code (SLOC) = 1478 Hits@level = [0] 8 [1] 7 [2] 22 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 41 [1+] 33 [2+] 26 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 27.7402 [1+] 22.3275 [2+] 17.5913 [3+] 2.70636 [4+] 2.70636 [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.