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/libsoundio-1.1.0/example/sio_list_devices.c
Examining data/libsoundio-1.1.0/example/sio_microphone.c
Examining data/libsoundio-1.1.0/example/sio_record.c
Examining data/libsoundio-1.1.0/example/sio_sine.c
Examining data/libsoundio-1.1.0/soundio/endian.h
Examining data/libsoundio-1.1.0/soundio/soundio.h
Examining data/libsoundio-1.1.0/src/alsa.c
Examining data/libsoundio-1.1.0/src/alsa.h
Examining data/libsoundio-1.1.0/src/atomics.h
Examining data/libsoundio-1.1.0/src/channel_layout.c
Examining data/libsoundio-1.1.0/src/coreaudio.c
Examining data/libsoundio-1.1.0/src/coreaudio.h
Examining data/libsoundio-1.1.0/src/dummy.c
Examining data/libsoundio-1.1.0/src/dummy.h
Examining data/libsoundio-1.1.0/src/jack.c
Examining data/libsoundio-1.1.0/src/jack.h
Examining data/libsoundio-1.1.0/src/list.h
Examining data/libsoundio-1.1.0/src/os.c
Examining data/libsoundio-1.1.0/src/os.h
Examining data/libsoundio-1.1.0/src/pulseaudio.c
Examining data/libsoundio-1.1.0/src/pulseaudio.h
Examining data/libsoundio-1.1.0/src/ring_buffer.c
Examining data/libsoundio-1.1.0/src/ring_buffer.h
Examining data/libsoundio-1.1.0/src/soundio.c
Examining data/libsoundio-1.1.0/src/soundio_internal.h
Examining data/libsoundio-1.1.0/src/soundio_private.h
Examining data/libsoundio-1.1.0/src/util.c
Examining data/libsoundio-1.1.0/src/util.h
Examining data/libsoundio-1.1.0/src/wasapi.c
Examining data/libsoundio-1.1.0/src/wasapi.h
Examining data/libsoundio-1.1.0/test/backend_disconnect_recover.c
Examining data/libsoundio-1.1.0/test/latency.c
Examining data/libsoundio-1.1.0/test/overflow.c
Examining data/libsoundio-1.1.0/test/underflow.c
Examining data/libsoundio-1.1.0/test/unit_tests.c

FINAL RESULTS:

data/libsoundio-1.1.0/example/sio_microphone.c:51:25:  [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, 1, 2)))
data/libsoundio-1.1.0/example/sio_microphone.c:55: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.
    vfprintf(stderr, format, ap);
data/libsoundio-1.1.0/src/alsa.c:266:66:  [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 err = snd_pcm_hw_params_set_access(handle, hwparams, access);
data/libsoundio-1.1.0/src/alsa.c:269:31:  [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.
                *out_access = access;
data/libsoundio-1.1.0/src/alsa.c:1310:56:  [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.
    if ((err = set_access(osa->handle, hwparams, &osa->access))) {
data/libsoundio-1.1.0/src/alsa.c:1632:56:  [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.
    if ((err = set_access(isa->handle, hwparams, &isa->access))) {
data/libsoundio-1.1.0/src/alsa.h:54:22:  [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.
    snd_pcm_access_t access;
data/libsoundio-1.1.0/src/alsa.h:76:22:  [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.
    snd_pcm_access_t access;
data/libsoundio-1.1.0/src/util.c:17: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.
    vfprintf(stderr, format, ap);
data/libsoundio-1.1.0/src/util.c:28:16:  [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.
    int len1 = vsnprintf(NULL, 0, format, ap);
data/libsoundio-1.1.0/src/util.c:36:16:  [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.
    int len2 = vsnprintf(mem, required_size, format, ap2);
data/libsoundio-1.1.0/src/util.h:66:25:  [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.
    SOUNDIO_ATTR_FORMAT(printf, 1, 2)
data/libsoundio-1.1.0/src/util.h:70:25:  [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.
    SOUNDIO_ATTR_FORMAT(printf, 2, 3);
data/libsoundio-1.1.0/test/backend_disconnect_recover.c:19:25:  [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, 1, 2)))
data/libsoundio-1.1.0/test/backend_disconnect_recover.c:23: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.
    vfprintf(stderr, format, ap);
data/libsoundio-1.1.0/test/overflow.c:41:25:  [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, 1, 2)))
data/libsoundio-1.1.0/test/overflow.c:45: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.
    vfprintf(stderr, format, ap);
data/libsoundio-1.1.0/test/underflow.c:20:25:  [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, 1, 2)))
data/libsoundio-1.1.0/test/underflow.c:24: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.
    vfprintf(stderr, format, ap);
data/libsoundio-1.1.0/src/os.c:293:5:  [3] (misc) InitializeCriticalSection:
  Exceptions can be thrown in low-memory situations. Use
  InitializeCriticalSectionAndSpinCount instead.
    InitializeCriticalSection(&mutex->id);
data/libsoundio-1.1.0/src/os.c:323:5:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
    EnterCriticalSection(&mutex->id);
data/libsoundio-1.1.0/src/os.c:347:5:  [3] (misc) InitializeCriticalSection:
  Exceptions can be thrown in low-memory situations. Use
  InitializeCriticalSectionAndSpinCount instead.
    InitializeCriticalSection(&cond->default_cs_id);
data/libsoundio-1.1.0/src/os.c:411:9:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
        EnterCriticalSection(&cond->default_cs_id);
data/libsoundio-1.1.0/src/os.c:451:9:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
        EnterCriticalSection(&cond->default_cs_id);
data/libsoundio-1.1.0/src/os.c:515:9:  [3] (misc) EnterCriticalSection:
  On some versions of Windows, exceptions can be thrown in low-memory
  situations. Use InitializeCriticalSectionAndSpinCount instead.
        EnterCriticalSection(&cond->default_cs_id);
data/libsoundio-1.1.0/example/sio_microphone.c:95:21:  [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(write_ptr, areas[ch].ptr, instream->bytes_per_sample);
data/libsoundio-1.1.0/example/sio_microphone.c:155:17:  [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(areas[ch].ptr, read_ptr, outstream->bytes_per_sample);
data/libsoundio-1.1.0/example/sio_record.c:90:21:  [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(write_ptr, areas[ch].ptr, instream->bytes_per_sample);
data/libsoundio-1.1.0/example/sio_record.c:243:19:  [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).
    FILE *out_f = fopen(outfile, "wb");
data/libsoundio-1.1.0/example/sio_sine.c:149:35:  [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).
                    sample_rate = atoi(argv[i]);
data/libsoundio-1.1.0/src/alsa.c:664: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 name[32];
data/libsoundio-1.1.0/src/alsa.c:665:9:  [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(name, "hw:%d", card_index);
data/libsoundio-1.1.0/src/alsa.c:802: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[4096] __attribute__ ((aligned(__alignof__(struct inotify_event))));
data/libsoundio-1.1.0/src/alsa.c:1483:36:  [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.
            osa->areas[ch].ptr = ((char *)areas[ch].addr) + (areas[ch].first / 8) +
data/libsoundio-1.1.0/src/alsa.c:1503: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 *ptrs[SOUNDIO_MAX_CHANNELS];
data/libsoundio-1.1.0/src/alsa.c:1771: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 *ptrs[SOUNDIO_MAX_CHANNELS];
data/libsoundio-1.1.0/src/alsa.c:1801:36:  [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.
            isa->areas[ch].ptr = ((char *)areas[ch].addr) + (areas[ch].first / 8) +
data/libsoundio-1.1.0/src/alsa.h:25: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[SOUNDIO_MAX_ALSA_SND_FILE_LEN];
data/libsoundio-1.1.0/src/channel_layout.c:312:15:  [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.
typedef const char *channel_names_t[CHANNEL_NAME_ALIAS_COUNT];
data/libsoundio-1.1.0/src/jack.c:228: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(device->name, client->name, client->name_len);
data/libsoundio-1.1.0/src/jack.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(&device->name[client->name_len], ": ", 2);
data/libsoundio-1.1.0/src/jack.c:233: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(&device->name[index], port->name, port->name_len);
data/libsoundio-1.1.0/src/jack.c:236:17:  [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(&device->name[index], ", ", 2);
data/libsoundio-1.1.0/src/jack.h: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 *buf_ptrs[SOUNDIO_MAX_CHANNELS];
data/libsoundio-1.1.0/src/os.c:677:14:  [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 fd = mkstemp(shm_path);
data/libsoundio-1.1.0/src/os.c:679:14:  [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).
        fd = mkstemp(tmp_path);
data/libsoundio-1.1.0/src/util.h:76: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(out, str, str_len);
data/libsoundio-1.1.0/src/wasapi.c:223:17:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
    int w_len = MultiByteToWideChar(CP_UTF8, flags, str, str_len, NULL, 0);
data/libsoundio-1.1.0/src/wasapi.c:231:9:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
    if (MultiByteToWideChar(CP_UTF8, flags, str, str_len, buf, w_len) != w_len) {
data/libsoundio-1.1.0/test/backend_disconnect_recover.c:56:27:  [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).
                timeout = atoi(argv[i]);
data/libsoundio-1.1.0/test/underflow.c:163:35:  [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).
                    sample_rate = atoi(argv[i]);
data/libsoundio-1.1.0/test/unit_tests.c:69:15:  [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.
    int amt = sprintf(write_ptr, "hello") + 1;
data/libsoundio-1.1.0/test/unit_tests.c:86:11:  [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.
    amt = sprintf(soundio_ring_buffer_write_ptr(rb), "writing past the end") + 1;
data/libsoundio-1.1.0/example/sio_sine.c:256:17:  [1] (buffer) getc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        int c = getc(stdin);
data/libsoundio-1.1.0/src/alsa.c:471: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).
    return strncmp(big_str, prefix, strlen(prefix)) == 0;
data/libsoundio-1.1.0/src/alsa.c:832:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                ssize_t len = read(sia->notify_fd, buf, sizeof(buf));
data/libsoundio-1.1.0/src/alsa.c:903:31:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                ssize_t len = read(sia->notify_pipe_fd[0], buf, sizeof(buf));
data/libsoundio-1.1.0/src/channel_layout.c:459: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).
            int alias_len = strlen(alias);
data/libsoundio-1.1.0/src/coreaudio.c:193:20:  [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).
    *out_str_len = strlen(buf);
data/libsoundio-1.1.0/src/jack.c:109:40:  [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 client_and_port_name_len = strlen(client_and_port_name);
data/libsoundio-1.1.0/src/wasapi.c:1301: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).
        if ((err = to_lpwstr(outstream->name, strlen(outstream->name), &osw->stream_name))) {
data/libsoundio-1.1.0/src/wasapi.c:1804:46:  [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 ((err = to_lpwstr(instream->name, strlen(instream->name), &isw->stream_name))) {

ANALYSIS SUMMARY:

Hits = 62
Lines analyzed = 15085 in approximately 0.37 seconds (41223 lines/second)
Physical Source Lines of Code (SLOC) = 11838
Hits@level = [0] 122 [1]   9 [2]  28 [3]   6 [4]  19 [5]   0
Hits@level+ = [0+] 184 [1+]  62 [2+]  53 [3+]  25 [4+]  19 [5+]   0
Hits/KSLOC@level+ = [0+] 15.5432 [1+] 5.23737 [2+] 4.47711 [3+] 2.11184 [4+] 1.605 [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.