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/pytsk-20200117/aff4_errors.h Examining data/pytsk-20200117/class.c Examining data/pytsk-20200117/class.h Examining data/pytsk-20200117/error.c Examining data/pytsk-20200117/misc.h Examining data/pytsk-20200117/pytsk3.h Examining data/pytsk-20200117/talloc/replace.h Examining data/pytsk-20200117/talloc/talloc.c Examining data/pytsk-20200117/talloc/talloc.h Examining data/pytsk-20200117/tsk3.c Examining data/pytsk-20200117/tsk3.h FINAL RESULTS: data/pytsk-20200117/error.c:83:5: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(error_buffer, "\n", ERROR_BUFF_SIZE -1 ); data/pytsk-20200117/error.c:86:3: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(error_buffer, tmp, ERROR_BUFF_SIZE-1); data/pytsk-20200117/error.c:72:5: [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. vsnprintf(tmp, ERROR_BUFF_SIZE-1, reason,ap); data/pytsk-20200117/talloc/talloc.c:2365: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(&c, 1, fmt, ap2); data/pytsk-20200117/talloc/talloc.c:2375:2: [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. vsnprintf(ret, len+1, fmt, ap2); data/pytsk-20200117/talloc/talloc.c:2410:9: [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. alen = vsnprintf(&c, 1, fmt, ap2); data/pytsk-20200117/talloc/talloc.c:2427:2: [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. vsnprintf(s + slen, alen + 1, fmt, ap2); data/pytsk-20200117/talloc/talloc.c:950: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 *fill = getenv(TALLOC_FILL_ENV); data/pytsk-20200117/error.c:30: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 global_error_buffer[ERROR_BUFF_SIZE]; data/pytsk-20200117/error.c:64: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 tmp[ERROR_BUFF_SIZE]; data/pytsk-20200117/talloc/talloc.c:1680:4: [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_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); data/pytsk-20200117/talloc/talloc.c:1689:4: [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_ptr, tc, MIN(tc->size, size) + TC_HDR_SIZE); data/pytsk-20200117/talloc/talloc.c:1796:4: [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_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); data/pytsk-20200117/talloc/talloc.c:2067: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. if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) { data/pytsk-20200117/talloc/talloc.c:2067:38: [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. if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) { data/pytsk-20200117/talloc/talloc.c:2068:24: [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. fprintf(f, "%c", ((char *)ptr)[i]); data/pytsk-20200117/talloc/talloc.c:2070:27: [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. fprintf(f, "~%02x", ((char *)ptr)[i]); data/pytsk-20200117/talloc/talloc.c:2214: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(newp, p, size); data/pytsk-20200117/talloc/talloc.c:2227: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(ret, p, len); data/pytsk-20200117/talloc/talloc.c:2261: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(&ret[slen], a, alen); data/pytsk-20200117/tsk3.c:326: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). VMETHOD(open) = FS_Info_open; data/pytsk-20200117/tsk3.h:238:27: [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 METHOD(FS_Info, open, ZString path); data/pytsk-20200117/class.h:396:37: [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). #define ZSTRING_NO_NULL(str) str , (strlen(str)) data/pytsk-20200117/class.h:397: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). #define ZSTRING(str) str , (strlen(str)+1) data/pytsk-20200117/talloc/talloc.c:2240:34: [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). return __talloc_strlendup(t, p, strlen(p)); data/pytsk-20200117/talloc/talloc.c:2281: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). return __talloc_strlendup_append(s, strlen(s), a, strlen(a)); data/pytsk-20200117/talloc/talloc.c:2281:52: [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). return __talloc_strlendup_append(s, strlen(s), a, strlen(a)); data/pytsk-20200117/talloc/talloc.c:2305: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). return __talloc_strlendup_append(s, slen, a, strlen(a)); data/pytsk-20200117/talloc/talloc.c:2321: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). return __talloc_strlendup_append(s, strlen(s), a, strnlen(a, n)); data/pytsk-20200117/talloc/talloc.c:2446:41: [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). return __talloc_vaslenprintf_append(s, strlen(s), fmt, ap); data/pytsk-20200117/tsk3.c:126:51: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read_count = CALL((TSK_IMG_INFO *) self->img, read, off, buf, len); data/pytsk-20200117/tsk3.c:155:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). VMETHOD(read) = Img_Info_read; data/pytsk-20200117/tsk3.c:172:44: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return (ssize_t) CALL(self->container, read, (uint64_t) off, buf, len); data/pytsk-20200117/tsk3.h:86:32: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). uint64_t METHOD(Img_Info, read, TSK_OFF_T off, OUT char *buf, size_t len); ANALYSIS SUMMARY: Hits = 34 Lines analyzed = 6595 in approximately 0.24 seconds (27726 lines/second) Physical Source Lines of Code (SLOC) = 3091 Hits@level = [0] 15 [1] 12 [2] 14 [3] 1 [4] 5 [5] 2 Hits@level+ = [0+] 49 [1+] 34 [2+] 22 [3+] 8 [4+] 7 [5+] 2 Hits/KSLOC@level+ = [0+] 15.8525 [1+] 10.9997 [2+] 7.11744 [3+] 2.58816 [4+] 2.26464 [5+] 0.64704 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.