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/libcanberra-0.30/src/canberra-boot.c
Examining data/libcanberra-0.30/src/driver-order.c
Examining data/libcanberra-0.30/src/proplist.c
Examining data/libcanberra-0.30/src/mutex-posix.c
Examining data/libcanberra-0.30/src/gstreamer.c
Examining data/libcanberra-0.30/src/common.h
Examining data/libcanberra-0.30/src/canberra-gtk-play.c
Examining data/libcanberra-0.30/src/fork-detect.h
Examining data/libcanberra-0.30/src/read-wav.h
Examining data/libcanberra-0.30/src/read-wav.c
Examining data/libcanberra-0.30/src/malloc.h
Examining data/libcanberra-0.30/src/malloc.c
Examining data/libcanberra-0.30/src/alsa.c
Examining data/libcanberra-0.30/src/sound-theme-spec.h
Examining data/libcanberra-0.30/src/dso.c
Examining data/libcanberra-0.30/src/llist.h
Examining data/libcanberra-0.30/src/null.c
Examining data/libcanberra-0.30/src/canberra-gtk.h
Examining data/libcanberra-0.30/src/oss.c
Examining data/libcanberra-0.30/src/read-vorbis.c
Examining data/libcanberra-0.30/src/cache.h
Examining data/libcanberra-0.30/src/macro.c
Examining data/libcanberra-0.30/src/pulse.c
Examining data/libcanberra-0.30/src/common.c
Examining data/libcanberra-0.30/src/proplist.h
Examining data/libcanberra-0.30/src/driver.h
Examining data/libcanberra-0.30/src/fork-detect.c
Examining data/libcanberra-0.30/src/macro.h
Examining data/libcanberra-0.30/src/read-sound-file.c
Examining data/libcanberra-0.30/src/sound-theme-spec.c
Examining data/libcanberra-0.30/src/driver-order.h
Examining data/libcanberra-0.30/src/read-vorbis.h
Examining data/libcanberra-0.30/src/test-canberra.c
Examining data/libcanberra-0.30/src/mutex.h
Examining data/libcanberra-0.30/src/cache.c
Examining data/libcanberra-0.30/src/canberra.h
Examining data/libcanberra-0.30/src/multi.c
Examining data/libcanberra-0.30/src/read-sound-file.h
Examining data/libcanberra-0.30/src/canberra-gtk-module.c
Examining data/libcanberra-0.30/src/canberra-gtk.c

FINAL RESULTS:

data/libcanberra-0.30/src/cache.c:87:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(r, "%s%s", env, subdir);
data/libcanberra-0.30/src/cache.c:367:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy(k, theme);
data/libcanberra-0.30/src/cache.c:369:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy(k, name);
data/libcanberra-0.30/src/cache.c:371:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy(k, locale);
data/libcanberra-0.30/src/cache.c:373:9:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
        strcpy(k, profile);
data/libcanberra-0.30/src/cache.c:413:17:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
                sprintf(k, "%s/sounds", e);
data/libcanberra-0.30/src/cache.c:586:17:  [4] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused).
                strcpy((char*) data + sizeof(uint32_t), fname);
data/libcanberra-0.30/src/canberra-boot.c:94:21:  [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 (access(d, F_OK) < 0)
data/libcanberra-0.30/src/canberra.h:556:102:  [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 ca_proplist_setf(ca_proplist *p, const char *key, const char *format, ...) __attribute__((format(printf, 3, 4)));
data/libcanberra-0.30/src/malloc.c:62:21:  [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.
                r = vsnprintf(c, size, format, ap);
data/libcanberra-0.30/src/malloc.h:52:72:  [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.
char *ca_sprintf_malloc(const char *format, ...) __attribute__((format(printf, 1, 2)));
data/libcanberra-0.30/src/proplist.c:161:21:  [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.
                r = vsnprintf(CA_PROP_DATA(prop), size, format, ap);
data/libcanberra-0.30/src/sound-theme-spec.c:79:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(r, "%s%s", env, subdir);
data/libcanberra-0.30/src/sound-theme-spec.c:158:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(fn, "%s/sounds/%s/index.theme", prefix, name);
data/libcanberra-0.30/src/sound-theme-spec.c:455:21:  [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 (access(fn, F_OK) == 0)
data/libcanberra-0.30/src/sound-theme-spec.c:493:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
        sprintf(p, "%s/sounds", path);
data/libcanberra-0.30/src/cache.c:75:20:  [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.
        if ((env = getenv("XDG_CACHE_HOME")) && *env == '/')
data/libcanberra-0.30/src/cache.c:77:25:  [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.
        else if ((env = getenv("HOME")) && *env == '/')
data/libcanberra-0.30/src/cache.c:236:14:  [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.
        if (!getenv("VALGRIND"))
data/libcanberra-0.30/src/common.c:149:18:  [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.
        if ((d = getenv("CANBERRA_DRIVER"))) {
data/libcanberra-0.30/src/common.c:156:18:  [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.
        if ((d = getenv("CANBERRA_DEVICE"))) {
data/libcanberra-0.30/src/macro.c:32:18:  [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.
        if ((d = getenv("CANBERRA_DEBUG")))
data/libcanberra-0.30/src/sound-theme-spec.c:67:20:  [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.
        if ((env = getenv("XDG_DATA_HOME")) && *env == '/')
data/libcanberra-0.30/src/sound-theme-spec.c:69:25:  [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.
        else if ((env = getenv("HOME")) && *env == '/')
data/libcanberra-0.30/src/sound-theme-spec.c:323:19:  [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.
        if (!(g = getenv("XDG_DATA_DIRS")) || *g == 0)
data/libcanberra-0.30/src/test-canberra.c:54:66:  [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.
                                      CA_PROP_WINDOW_X11_SCREEN, getenv("DISPLAY"),
data/libcanberra-0.30/src/cache.c:121:18:  [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).
        if ((f = fopen(CA_MACHINE_ID, "r"))) {
data/libcanberra-0.30/src/cache.c:122:17:  [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 ln[34] = "", *r;
data/libcanberra-0.30/src/cache.c:434:25:  [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(k, g, j);
data/libcanberra-0.30/src/cache.c:435:25:  [2] (buffer) strcpy:
  Does not check for buffer overflows when copying to destination [MS-banned]
  (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy
  easily misused). Risk is low because the source is a constant string.
                        strcpy(k+j, "/sounds");
data/libcanberra-0.30/src/canberra-boot.c:70:17:  [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 d[64];
data/libcanberra-0.30/src/common.c:650: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.
        const char * const error_table[-_CA_ERROR_MAX] = {
data/libcanberra-0.30/src/dso.c:151: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 sn[256];
data/libcanberra-0.30/src/gstreamer.c:280:19:  [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).
        if ((fd = open(fn, O_RDONLY)) == -1)
data/libcanberra-0.30/src/malloc.c:42: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(r, p, size);
data/libcanberra-0.30/src/malloc.c:95: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(p, s, n_avail);
data/libcanberra-0.30/src/oss.c:243:25:  [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).
        if ((out->pcm = open(c->device ? c->device : "/dev/dsp", O_WRONLY | O_NONBLOCK, 0)) < 0)
data/libcanberra-0.30/src/proplist.c:238: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(CA_PROP_DATA(prop), data, nbytes);
data/libcanberra-0.30/src/read-sound-file.c:62:22:  [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).
        if (!(file = fopen(fn, "r"))) {
data/libcanberra-0.30/src/sound-theme-spec.c:159:13:  [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).
        f = fopen(fn, "r");
data/libcanberra-0.30/src/sound-theme-spec.c:170:17:  [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 ln[1024];
data/libcanberra-0.30/src/cache.c:84:32:  [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 (!(r = ca_new(char, strlen(env) + strlen(subdir) + 1)))
data/libcanberra-0.30/src/cache.c:84: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 (!(r = ca_new(char, strlen(env) + strlen(subdir) + 1)))
data/libcanberra-0.30/src/cache.c:100: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).
        if (strlen(n) >= l-1) {
data/libcanberra-0.30/src/cache.c:357:14:  [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).
        tl = strlen(theme);
data/libcanberra-0.30/src/cache.c:358:14:  [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).
        nl = strlen(name);
data/libcanberra-0.30/src/cache.c:359:14:  [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).
        ll = strlen(locale);
data/libcanberra-0.30/src/cache.c:360:14:  [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).
        pl = strlen(profile);
data/libcanberra-0.30/src/cache.c:407: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).
                if (!(k = ca_new(char, strlen(e) + sizeof("/sounds")))) {
data/libcanberra-0.30/src/cache.c:575:44:  [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).
        dlen = sizeof(uint32_t) + (fname ? strlen(fname) + 1 : 0);
data/libcanberra-0.30/src/canberra-boot.c:213:21:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
                if (read(fd, &u, sizeof(u)) < 0) {
data/libcanberra-0.30/src/canberra-gtk-play.c:95:21:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
        const char *equal;
data/libcanberra-0.30/src/malloc.c:86:27:  [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_avail = strlen(s);
data/libcanberra-0.30/src/proplist.c:119: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 ca_proplist_set(p, key, value, strlen(value)+1);
data/libcanberra-0.30/src/pulse.c:148:42:  [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 (strncmp(key, prefix, strlen(prefix)) == 0)
data/libcanberra-0.30/src/sound-theme-spec.c:76:32:  [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 (!(r = ca_new(char, strlen(env) + strlen(subdir) + 1)))
data/libcanberra-0.30/src/sound-theme-spec.c:76: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 (!(r = ca_new(char, strlen(env) + strlen(subdir) + 1)))
data/libcanberra-0.30/src/sound-theme-spec.c:155:33:  [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 (!(fn = ca_new(char, strlen(prefix) + sizeof("/sounds/")-1 + strlen(name) + sizeof("/index.theme"))))
data/libcanberra-0.30/src/sound-theme-spec.c:155:73:  [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 (!(fn = ca_new(char, strlen(prefix) + sizeof("/sounds/")-1 + strlen(name) + sizeof("/index.theme"))))
data/libcanberra-0.30/src/sound-theme-spec.c:193: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).
                if (ln[0] == '[' && ln[strlen(ln)-1] == ']') {
data/libcanberra-0.30/src/sound-theme-spec.c:196: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).
                        if (!(d = ca_strndup(ln+1, strlen(ln)-2))) {
data/libcanberra-0.30/src/sound-theme-spec.c:490:32:  [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 (!(p = ca_new(char, strlen(path) + sizeof("/sounds"))))
data/libcanberra-0.30/src/test-canberra.c:90: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.
        usleep(500000);

ANALYSIS SUMMARY:

Hits = 63
Lines analyzed = 11214 in approximately 0.40 seconds (27795 lines/second)
Physical Source Lines of Code (SLOC) = 6777
Hits@level = [0]  39 [1]  22 [2]  15 [3]  10 [4]  16 [5]   0
Hits@level+ = [0+] 102 [1+]  63 [2+]  41 [3+]  26 [4+]  16 [5+]   0
Hits/KSLOC@level+ = [0+] 15.0509 [1+] 9.29615 [2+] 6.04987 [3+] 3.83651 [4+] 2.36093 [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.