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/osspd-1.3.2/ossp-alsap.c Examining data/osspd-1.3.2/ossp-padsp.c Examining data/osspd-1.3.2/ossp-slave.h Examining data/osspd-1.3.2/ossp-util.c Examining data/osspd-1.3.2/ossp-util.h Examining data/osspd-1.3.2/ossp.c Examining data/osspd-1.3.2/ossp.h Examining data/osspd-1.3.2/osstest.c Examining data/osspd-1.3.2/ossp-slave.c Examining data/osspd-1.3.2/osspd.c FINAL RESULTS: data/osspd-1.3.2/ossp-alsap.c:198:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. int access; data/osspd-1.3.2/ossp-util.c:90: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. off += vsnprintf(buf + off, len - off, fmt, ap); data/osspd-1.3.2/ossp-util.h:69:26: [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. __attribute__ ((format (printf, 2, 3))); data/osspd-1.3.2/osspd.c:1247:3: [4] (shell) execv: 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. execv(slave_path, argv); data/osspd-1.3.2/ossp-slave.c:57:16: [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 ((opt = getopt(argc, argv, "u:g:c:n:m:o:s:l:t")) != -1) { data/osspd-1.3.2/ossp-padsp.c:65: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 stream_name[128]; data/osspd-1.3.2/ossp-padsp.c:416: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 buf[128]; data/osspd-1.3.2/ossp-padsp.c:728: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 host_name[128] = "(unknown)", opener[128] = "(unknown)"; data/osspd-1.3.2/ossp-padsp.c:1119: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(dout, data, cnt); data/osspd-1.3.2/ossp-slave.c:40:1: [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 ossp_user_name[OSSP_USER_NAME_LEN]; data/osspd-1.3.2/ossp-slave.c:55: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 pw_sbuf[sysconf(_SC_GETPW_R_SIZE_MAX)]; data/osspd-1.3.2/ossp-slave.c:142: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 cmsg_buf[CMSG_SPACE(sizeof(fd))]; data/osspd-1.3.2/ossp-slave.h:18: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. extern char ossp_user_name[OSSP_USER_NAME_LEN]; data/osspd-1.3.2/ossp-util.c:28:1: [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 ossp_log_name[OSSP_LOG_NAME_LEN]; data/osspd-1.3.2/ossp-util.c:53: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[1024]; data/osspd-1.3.2/ossp-util.c:79: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 sev_buf[16] = ""; data/osspd-1.3.2/ossp-util.c:156: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(ring->buf + ring->head, buf, todo); data/osspd-1.3.2/ossp-util.c:164: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(ring->buf + ring->head, buf, size); data/osspd-1.3.2/ossp-util.c:314: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 path[64], buf[4096]; data/osspd-1.3.2/ossp-util.c:322:7: [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). fd = open(path, O_RDONLY); data/osspd-1.3.2/ossp-util.c:360: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(cmd_buf, cmd_start, len); data/osspd-1.3.2/ossp-util.h:34: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. extern char ossp_log_name[OSSP_LOG_NAME_LEN]; data/osspd-1.3.2/ossp.c:45: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. const char *ossp_cmd_str[OSSP_NR_OPCODES] = { data/osspd-1.3.2/ossp.c:79: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. const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES] = { data/osspd-1.3.2/ossp.h:114: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. extern const char *ossp_cmd_str[OSSP_NR_OPCODES]; data/osspd-1.3.2/ossp.h:115: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. extern const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES]; data/osspd-1.3.2/osspd.c:151: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 dsp_slave_path[PATH_MAX]; data/osspd-1.3.2/osspd.c:271: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 cmsg_buf[CMSG_SPACE(sizeof(fd))]; data/osspd-1.3.2/osspd.c:272: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 reason[512]; data/osspd-1.3.2/osspd.c:385: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(marg.vol, os->vol_set, sizeof(os->vol_set)); data/osspd-1.3.2/osspd.c:447: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(in, in_buf, in_sz); data/osspd-1.3.2/osspd.c:1061: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 procenviron[32]; data/osspd-1.3.2/osspd.c:1071:2: [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(procenviron, "/proc/%d/environ", pid); data/osspd-1.3.2/osspd.c:1072:7: [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). fd = open(procenviron, O_RDONLY); data/osspd-1.3.2/osspd.c:1192: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 id_str[2][16], fd_str[3][16]; data/osspd-1.3.2/osspd.c:1193: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 mmap_off_str[32], mmap_size_str[32]; data/osspd-1.3.2/osspd.c:1194: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 log_str[16], slave_path_copy[PATH_MAX]; data/osspd-1.3.2/osspd.c:1343: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(mxcmd.set.vol, os->vol, sizeof(os->vol)); data/osspd-1.3.2/osspd.c:1899:7: [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). fd = open("/dev/null", O_RDWR); data/osspd-1.3.2/osspd.c:2065: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 name_buf[128]; data/osspd-1.3.2/osspd.c:2135: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 adsp_buf[64] = "", mixer_buf[64] = ""; data/osspd-1.3.2/osstest.c:49:10: [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). dspfd = open(DSPDEV, O_RDWR|blocking); data/osspd-1.3.2/osstest.c:56: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[1024]; data/osspd-1.3.2/osstest.c:78: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[1024]; data/osspd-1.3.2/osstest.c:100: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[1024]; data/osspd-1.3.2/osstest.c:121:12: [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). mixerfd = open(MIXERDEV, O_RDONLY|O_NDELAY); data/osspd-1.3.2/osstest.c:130:10: [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). ro_fd = open(DSPDEV, O_RDONLY); data/osspd-1.3.2/osstest.c:138:10: [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). wo_fd = open(DSPDEV, O_WRONLY); data/osspd-1.3.2/osstest.c:146:10: [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). rw_fd = open(DSPDEV, O_RDWR); data/osspd-1.3.2/osstest.c:195: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[24]; data/osspd-1.3.2/ossp-util.c:107:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, size); data/osspd-1.3.2/ossp-util.c:328:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/osspd-1.3.2/osspd.c:710:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info.id, id, sizeof(info.id) - 1); data/osspd-1.3.2/osspd.c:711:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info.name, name, sizeof(info.name) - 1); data/osspd-1.3.2/osspd.c:720:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info.id, id, sizeof(info.id) - 1); data/osspd-1.3.2/osspd.c:721:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(info.name, name, sizeof(info.name) - 1); data/osspd-1.3.2/osspd.c:1080:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ret = read(fd, data + ofs, step)) > 0) { data/osspd-1.3.2/osspd.c:1095:17: [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 ((ret = strlen(ptr)) > 0) { data/osspd-1.3.2/osspd.c:1223:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(slave_path_copy, slave_path, sizeof(slave_path_copy) - 1); data/osspd-1.3.2/osspd.c:1771:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ret = read(os->notify_rx, data/osspd-1.3.2/osspd.c:1933:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(pfd[0], &err, sizeof(err)); data/osspd-1.3.2/osspd.c:2179:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(dsp_slave_path, param.dsp_slave_path, PATH_MAX - 1); data/osspd-1.3.2/osspd.c:2244:6: [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(param.mixer_name)) data/osspd-1.3.2/osspd.c:2248:6: [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(param.adsp_name)) data/osspd-1.3.2/osstest.c:60:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/osspd-1.3.2/osstest.c:82:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); data/osspd-1.3.2/osstest.c:104:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, buf, sizeof(buf)); ANALYSIS SUMMARY: Hits = 67 Lines analyzed = 6126 in approximately 0.15 seconds (40965 lines/second) Physical Source Lines of Code (SLOC) = 4662 Hits@level = [0] 36 [1] 17 [2] 45 [3] 1 [4] 4 [5] 0 Hits@level+ = [0+] 103 [1+] 67 [2+] 50 [3+] 5 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 22.0935 [1+] 14.3715 [2+] 10.725 [3+] 1.0725 [4+] 0.858001 [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.