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/tcpslice-1.3/compiler-tests.h Examining data/tcpslice-1.3/gmt2local.c Examining data/tcpslice-1.3/gmt2local.h Examining data/tcpslice-1.3/gwtm2secs.c Examining data/tcpslice-1.3/lbl/os-solaris2.h Examining data/tcpslice-1.3/lbl/os-sunos4.h Examining data/tcpslice-1.3/machdep.c Examining data/tcpslice-1.3/machdep.h Examining data/tcpslice-1.3/missing/strlcpy.c Examining data/tcpslice-1.3/search.c Examining data/tcpslice-1.3/seek-tell.c Examining data/tcpslice-1.3/sessions.c Examining data/tcpslice-1.3/sessions.h Examining data/tcpslice-1.3/tcpslice.c Examining data/tcpslice-1.3/tcpslice.h Examining data/tcpslice-1.3/util.c Examining data/tcpslice-1.3/varattrs.h FINAL RESULTS: data/tcpslice-1.3/lbl/os-sunos4.h:130:5: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. int readlink(const char *, char *, int); data/tcpslice-1.3/lbl/os-solaris2.h:24:5: [4] (format) snprintf: 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. int snprintf(char *, size_t, const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:29:5: [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. int fprintf(FILE *, const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:40:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. int vfprintf(FILE *, const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:41:5: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. int vprintf(const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:62:7: [4] (crypto) crypt: The crypt functions use a poor one-way hashing algorithm; since they only accept passwords of 8 characters or fewer and only a two-byte salt, they are excessively vulnerable to dictionary attacks given today's faster computing equipment (CWE-327). Use a different algorithm, such as SHA-256, with a larger, non-repeating salt. char *crypt(const char *, const char *); data/tcpslice-1.3/lbl/os-sunos4.h:93:7: [4] (misc) getpass: This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data (e.g., /dev/tty, stdin, stderr, etc.). In addition, some implementations overflow buffers. (CWE-676, CWE-120, CWE-20). Make the specific calls to do exactly what you want. If you continue to use it, or write your own, be sure to zero the password as soon as possible to avoid leaving the cleartext password visible in the process' address space. char *getpass(char *); data/tcpslice-1.3/lbl/os-sunos4.h:123:7: [4] (tmpfile) mktemp: Temporary file race condition (CWE-377). char *mktemp(char *); data/tcpslice-1.3/lbl/os-sunos4.h:127:5: [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. int printf(const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:160:5: [4] (format) snprintf: 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. int snprintf(char *, size_t, const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:165: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. If the scanf format is influenceable by an attacker, it's exploitable. int sscanf(char *, const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:177:6: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. void syslog(int, const char *, ...); data/tcpslice-1.3/lbl/os-sunos4.h:178:5: [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. int system(const char *); data/tcpslice-1.3/lbl/os-sunos4.h:187:5: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. int vsprintf(char *, const char *, ...); data/tcpslice-1.3/sessions.c:553:3: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(d->filename, sessions_file_format, type2string(t, 0), id); data/tcpslice-1.3/util.c:50:8: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. (void)vfprintf(stderr, fmt, ap); data/tcpslice-1.3/lbl/os-sunos4.h:58:5: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. int chroot(const char *); data/tcpslice-1.3/lbl/os-sunos4.h:91:5: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt(int, char * const *, const char *); data/tcpslice-1.3/lbl/os-sunos4.h:108:7: [3] (buffer) getwd: This does not protect against buffer overflows by itself, so use with caution (CWE-120, CWE-20). Use getcwd instead. char *getwd(char *); data/tcpslice-1.3/lbl/os-sunos4.h:129:6: [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. long random(void); data/tcpslice-1.3/lbl/os-sunos4.h:164:6: [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. void srandom(int); data/tcpslice-1.3/tcpslice.c:185:15: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((op = getopt(argc, argv, "dDe:f:hlRrs:tvw:")) != EOF) data/tcpslice-1.3/lbl/os-sunos4.h:56:6: [2] (buffer) bcopy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. void bcopy(const void *, void *, u_int); data/tcpslice-1.3/lbl/os-sunos4.h:122:5: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int mkstemp(char *); data/tcpslice-1.3/lbl/os-sunos4.h:186:5: [2] (race) vfork: On some old systems, vfork() permits race conditions, and it's very difficult to use correctly (CWE-362). Use fork() instead. int vfork(void); data/tcpslice-1.3/sessions.c:225: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 call_id[16]; data/tcpslice-1.3/sessions.c:624: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(frame, nids_last_pcap_data, nids_linkoffset); data/tcpslice-1.3/sessions.c:625: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(frame + nids_linkoffset, data, len); data/tcpslice-1.3/sessions.c:798:15: [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). *port = atoi(tmp); data/tcpslice-1.3/sessions.c:934: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(ras->u.ras_params.call_id, pRasMsg->u.admissionRequest->conferenceID.data, 16); data/tcpslice-1.3/sessions.c:992: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 callToken[20]; data/tcpslice-1.3/tcpslice.c:171: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 ebuf[PCAP_ERRBUF_SIZE]; data/tcpslice-1.3/tcpslice.c:197:32: [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). sessions_expiration_delay = atoi(optarg); data/tcpslice-1.3/tcpslice.c:534:19: [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). result.tv_sec = atoi( time_string ); data/tcpslice-1.3/tcpslice.c:540: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). result.tv_usec = atoi( time_ptr + 1 ); data/tcpslice-1.3/tcpslice.c:648:9: [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). val = atoi(t_start); data/tcpslice-1.3/tcpslice.c:756: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[PCAP_ERRBUF_SIZE]; data/tcpslice-1.3/tcpslice.c:968: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(last_pkt, min_state->pkt, min_state->hdr.caplen); data/tcpslice-1.3/tcpslice.c:992: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. static char buffers[NUM_BUFFERS][128]; data/tcpslice-1.3/tcpslice.c:1002:3: [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( buf, "%u.%06u", data/tcpslice-1.3/tcpslice.c:1015:3: [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( buf, "%04dy%02dm%02dd%02dh%02dm%02ds%06uu", data/tcpslice-1.3/lbl/os-sunos4.h:28:5: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int fgetc(FILE *); data/tcpslice-1.3/lbl/os-sunos4.h:45:5: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read(int, char *, u_int); data/tcpslice-1.3/sessions.c:552:24: [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). d->filename = malloc(strlen(sessions_file_format) + strlen(type2string(t, 0)) + 16); data/tcpslice-1.3/sessions.c:552:55: [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). d->filename = malloc(strlen(sessions_file_format) + strlen(type2string(t, 0)) + 16); data/tcpslice-1.3/tcpslice.c:539:21: [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 num_digits = strlen( time_ptr + 1 ); data/tcpslice-1.3/util.c:53: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). fmt += strlen(fmt); ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 3875 in approximately 0.13 seconds (30928 lines/second) Physical Source Lines of Code (SLOC) = 2295 Hits@level = [0] 30 [1] 6 [2] 19 [3] 6 [4] 15 [5] 1 Hits@level+ = [0+] 77 [1+] 47 [2+] 41 [3+] 22 [4+] 16 [5+] 1 Hits/KSLOC@level+ = [0+] 33.5512 [1+] 20.4793 [2+] 17.8649 [3+] 9.58606 [4+] 6.97168 [5+] 0.43573 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.