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/pth-2.0.7/pth_attr.c Examining data/pth-2.0.7/pth_cancel.c Examining data/pth-2.0.7/pth_clean.c Examining data/pth-2.0.7/pth_compat.c Examining data/pth-2.0.7/pth_data.c Examining data/pth-2.0.7/pth_debug.c Examining data/pth-2.0.7/pth_errno.c Examining data/pth-2.0.7/pth_event.c Examining data/pth-2.0.7/pth_ext.c Examining data/pth-2.0.7/pth_fork.c Examining data/pth-2.0.7/pth_high.c Examining data/pth-2.0.7/pth_lib.c Examining data/pth-2.0.7/pth_msg.c Examining data/pth-2.0.7/pth_pqueue.c Examining data/pth-2.0.7/pth_ring.c Examining data/pth-2.0.7/pth_string.c Examining data/pth-2.0.7/pth_sync.c Examining data/pth-2.0.7/pth_syscall.c Examining data/pth-2.0.7/pth_tcb.c Examining data/pth-2.0.7/pth_time.c Examining data/pth-2.0.7/pth_uctx.c Examining data/pth-2.0.7/pth_util.c Examining data/pth-2.0.7/pth_vers.c Examining data/pth-2.0.7/pthread.c Examining data/pth-2.0.7/test_common.c Examining data/pth-2.0.7/test_common.h Examining data/pth-2.0.7/test_httpd.c Examining data/pth-2.0.7/test_misc.c Examining data/pth-2.0.7/test_mp.c Examining data/pth-2.0.7/test_philo.c Examining data/pth-2.0.7/test_pthread.c Examining data/pth-2.0.7/test_select.c Examining data/pth-2.0.7/test_sfio.c Examining data/pth-2.0.7/test_sig.c Examining data/pth-2.0.7/test_std.c Examining data/pth-2.0.7/pth_sched.c Examining data/pth-2.0.7/pth_mctx.c Examining data/pth-2.0.7/test_uctx.c FINAL RESULTS: data/pth-2.0.7/pth_high.c:259:13: [4] (shell) execl: 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. execl(PTH_PATH_BINSH, "sh", "-c", cmd, (char *)NULL); data/pth-2.0.7/pth_syscall.c:39:9: [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. #define system __pth_sys_system data/pth-2.0.7/pth_syscall.c:90:8: [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. #undef system data/pth-2.0.7/pth_syscall.c:283:10: [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. do { fprintf(stderr, \ data/pth-2.0.7/pth_syscall.c:346: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/pth-2.0.7/pth_syscall.c:347: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 *cmd) data/pth-2.0.7/pth_attr.c:41: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 a_name[PTH_TCB_NAMELEN]; data/pth-2.0.7/pth_debug.c:58:12: [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 str[1024]; data/pth-2.0.7/pth_high.c:352: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(&rspare, rfds, sizeof(fd_set)); data/pth-2.0.7/pth_high.c:357: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(&wspare, wfds, sizeof(fd_set)); data/pth-2.0.7/pth_high.c:362: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(&espare, efds, sizeof(fd_set)); data/pth-2.0.7/pth_high.c:377: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(rfds, &rspare, sizeof(fd_set)); data/pth-2.0.7/pth_high.c:379: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(wfds, &wspare, sizeof(fd_set)); data/pth-2.0.7/pth_high.c:381: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(efds, &espare, sizeof(fd_set)); data/pth-2.0.7/pth_high.c:472: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 data[64]; data/pth-2.0.7/pth_high.c:983: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(iov[i].iov_base, buffer, copy); data/pth-2.0.7/pth_high.c:1216:10: [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(cp, iov[i].iov_base, copy); data/pth-2.0.7/pth_mctx.c:352: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((void *)&mctx_creating_sigs, &osigs, sizeof(sigset_t)); data/pth-2.0.7/pth_sched.c:411: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 minibuf[128]; data/pth-2.0.7/pth_sched.c:756:33: [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(&trfds, ev->ev_args.SELECT.rfds, sizeof(rfds)); data/pth-2.0.7/pth_sched.c:760:33: [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(&twfds, ev->ev_args.SELECT.wfds, sizeof(wfds)); data/pth-2.0.7/pth_sched.c:764:33: [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(&tefds, ev->ev_args.SELECT.efds, sizeof(efds)); data/pth-2.0.7/pth_string.c:406: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 convert[20]; data/pth-2.0.7/pth_string.c:521: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 iconvert[20]; data/pth-2.0.7/pth_string.c:522: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 fconvert[20]; data/pth-2.0.7/pth_tcb.c:42: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 name[PTH_TCB_NAMELEN];/* name of thread (mainly for debugging) */ data/pth-2.0.7/test_common.c:50: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 rl_buf[READLINE_MAXLEN]; data/pth-2.0.7/test_httpd.c:55: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 caLine[MAXREQLINE]; data/pth-2.0.7/test_httpd.c:56: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[1024]; data/pth-2.0.7/test_httpd.c:78:5: [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(str, "HTTP/1.0 200 Ok\r\n" data/pth-2.0.7/test_httpd.c:158:12: [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(argv[1]); data/pth-2.0.7/test_misc.c:38: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 buf[3]; data/pth-2.0.7/test_mp.c:99: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 caLine[MAXLINELEN]; data/pth-2.0.7/test_philo.c:53:14: [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 const char *philstatstr[3] = { data/pth-2.0.7/test_sfio.c:40: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/pth-2.0.7/pth_debug.c:67: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). n = strlen(str); data/pth-2.0.7/pth_debug.c:73: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). n = strlen(str); data/pth-2.0.7/pth_high.c:772:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = pth_sc(read)(fd, buf, nbytes)) < 0 data/pth-2.0.7/pth_high.c:976:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rv = pth_sc(read)(fd, buffer, bytes); data/pth-2.0.7/pth_sched.c:610:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (pth_sc(read)(pth_sigpipe[0], minibuf, sizeof(minibuf)) > 0) ; data/pth-2.0.7/pth_syscall.c:41:9: [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. #define usleep __pth_sys_usleep data/pth-2.0.7/pth_syscall.c:50:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define read __pth_sys_read data/pth-2.0.7/pth_syscall.c:92:8: [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. #undef usleep data/pth-2.0.7/pth_syscall.c:101:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #undef read data/pth-2.0.7/pth_syscall.c:324: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. int usleep(unsigned int); data/pth-2.0.7/pth_syscall.c:325: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. int usleep(unsigned int sec) data/pth-2.0.7/pth_syscall.c:523:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read(int, void *, size_t); data/pth-2.0.7/pth_syscall.c:524:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read(int fd, void *buf, size_t nbytes) data/pth-2.0.7/pth_time.c:46: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((unsigned int )usec); data/pth-2.0.7/test_httpd.c:85: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). pth_write(fd, str, strlen(str)); data/pth-2.0.7/test_httpd.c:107: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). ct[strlen(ct)-1] = NUL; ANALYSIS SUMMARY: Hits = 51 Lines analyzed = 11193 in approximately 0.30 seconds (37009 lines/second) Physical Source Lines of Code (SLOC) = 7605 Hits@level = [0] 186 [1] 16 [2] 29 [3] 0 [4] 6 [5] 0 Hits@level+ = [0+] 237 [1+] 51 [2+] 35 [3+] 6 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 31.1637 [1+] 6.70611 [2+] 4.60224 [3+] 0.788955 [4+] 0.788955 [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.