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/gmrender-resurrect-0.0.8/src/logging.c Examining data/gmrender-resurrect-0.0.8/src/logging.h Examining data/gmrender-resurrect-0.0.8/src/main.c Examining data/gmrender-resurrect-0.0.8/src/output.c Examining data/gmrender-resurrect-0.0.8/src/output.h Examining data/gmrender-resurrect-0.0.8/src/output_gstreamer.c Examining data/gmrender-resurrect-0.0.8/src/output_gstreamer.h Examining data/gmrender-resurrect-0.0.8/src/output_module.h Examining data/gmrender-resurrect-0.0.8/src/song-meta-data.c Examining data/gmrender-resurrect-0.0.8/src/song-meta-data.h Examining data/gmrender-resurrect-0.0.8/src/upnp.c Examining data/gmrender-resurrect-0.0.8/src/upnp.h Examining data/gmrender-resurrect-0.0.8/src/upnp_compat.h Examining data/gmrender-resurrect-0.0.8/src/upnp_connmgr.c Examining data/gmrender-resurrect-0.0.8/src/upnp_connmgr.h Examining data/gmrender-resurrect-0.0.8/src/upnp_control.c Examining data/gmrender-resurrect-0.0.8/src/upnp_control.h Examining data/gmrender-resurrect-0.0.8/src/upnp_device.c Examining data/gmrender-resurrect-0.0.8/src/upnp_device.h Examining data/gmrender-resurrect-0.0.8/src/upnp_renderer.c Examining data/gmrender-resurrect-0.0.8/src/upnp_renderer.h Examining data/gmrender-resurrect-0.0.8/src/upnp_transport.c Examining data/gmrender-resurrect-0.0.8/src/upnp_transport.h Examining data/gmrender-resurrect-0.0.8/src/variable-container.c Examining data/gmrender-resurrect-0.0.8/src/variable-container.h Examining data/gmrender-resurrect-0.0.8/src/webserver.c Examining data/gmrender-resurrect-0.0.8/src/webserver.h Examining data/gmrender-resurrect-0.0.8/src/xmldoc.c Examining data/gmrender-resurrect-0.0.8/src/xmldoc.h Examining data/gmrender-resurrect-0.0.8/src/xmlescape.c Examining data/gmrender-resurrect-0.0.8/src/xmlescape.h FINAL RESULTS: data/gmrender-resurrect-0.0.8/src/logging.h:29:29: [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, fmt_pos, args_pos))) data/gmrender-resurrect-0.0.8/src/song-meta-data.c:105:3: [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(result + offset + new_content_len, end_pos); // remaining data/gmrender-resurrect-0.0.8/src/upnp_connmgr.c:258:2: [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(type, mime_type); data/gmrender-resurrect-0.0.8/src/upnp_device.c:118:2: [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. vsnprintf(buffer, sizeof(buffer), format, ap); data/gmrender-resurrect-0.0.8/src/logging.c:62: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). log_fd = open(filename, O_CREAT|O_APPEND|O_WRONLY, 0644); data/gmrender-resurrect-0.0.8/src/logging.c:88: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 fmt_buf[128]; data/gmrender-resurrect-0.0.8/src/main.c:146: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 version[1024]; data/gmrender-resurrect-0.0.8/src/main.c:197: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 version[1024]; data/gmrender-resurrect-0.0.8/src/main.c:257:21: [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). pid_file_stream = fopen(pid_file, "w"); data/gmrender-resurrect-0.0.8/src/song-meta-data.c:103: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(result, input, start_pos - input); data/gmrender-resurrect-0.0.8/src/song-meta-data.c:104: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(result + offset, content, new_content_len); data/gmrender-resurrect-0.0.8/src/song-meta-data.c:112: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(input + offset, content, new_content_len); data/gmrender-resurrect-0.0.8/src/song-meta-data.c:161: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 unique_id[4 + 8 + 1]; data/gmrender-resurrect-0.0.8/src/upnp_connmgr.c:274: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(dest, str, len); data/gmrender-resurrect-0.0.8/src/upnp_control.c:621:22: [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). const int do_mute = atoi(value); data/gmrender-resurrect-0.0.8/src/upnp_control.c:670: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 volume[10]; data/gmrender-resurrect-0.0.8/src/upnp_control.c:672: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 db_volume[10]; data/gmrender-resurrect-0.0.8/src/upnp_control.c:697: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). int volume_level = atoi(volume); // range 0..100 data/gmrender-resurrect-0.0.8/src/upnp_control.c:702: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 db_volume[10]; data/gmrender-resurrect-0.0.8/src/upnp_control.c:724: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 minval[16]; data/gmrender-resurrect-0.0.8/src/upnp_device.c:117: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 buffer[LINE_SIZE]; data/gmrender-resurrect-0.0.8/src/upnp_transport.c:772: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 tbuf[32]; data/gmrender-resurrect-0.0.8/src/webserver.c:90: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 local_fname[512]; // PATH_MAX, but that is not defined everywhere data/gmrender-resurrect-0.0.8/src/webserver.c:115:8: [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). in = fopen(local_fname, "r"); data/gmrender-resurrect-0.0.8/src/webserver.c:205: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(buf, file->contents + file->pos, len); data/gmrender-resurrect-0.0.8/src/xmlescape.c:42: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(target + len, "<", 4); data/gmrender-resurrect-0.0.8/src/xmlescape.c:45: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(target + len, "%22", 3); data/gmrender-resurrect-0.0.8/src/xmlescape.c:48: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(target + len, ">", 4); data/gmrender-resurrect-0.0.8/src/xmlescape.c:51: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(target + len, "&", 5); data/gmrender-resurrect-0.0.8/src/main.c:187: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). int needs_newline = variable_value[strlen(variable_value) - 1] != '\n'; data/gmrender-resurrect-0.0.8/src/song-meta-data.c:90: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). const int total_len = strlen(input); data/gmrender-resurrect-0.0.8/src/song-meta-data.c:93:15: [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). start_pos += strlen(tag_start); data/gmrender-resurrect-0.0.8/src/song-meta-data.c:98:30: [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). const int new_content_len = strlen(content); data/gmrender-resurrect-0.0.8/src/song-meta-data.c:171:30: [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 (original_xml == NULL || strlen(original_xml) == 0) { data/gmrender-resurrect-0.0.8/src/upnp_compat.h:63:45: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). #define UpnpActionRequest_set_ErrStr(x, v) (strncpy((x)->ErrStr, UpnpString_get_String((v)), LINE_SIZE)) data/gmrender-resurrect-0.0.8/src/upnp_connmgr.c:254:22: [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). char* type = malloc(strlen(mime_type) + 1); data/gmrender-resurrect-0.0.8/src/upnp_connmgr.c:273: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). const size_t len = strlen(str); data/gmrender-resurrect-0.0.8/src/upnp_connmgr.c:301:19: [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). bufsize += 11 + strlen(entry->mime_type) + 3; data/gmrender-resurrect-0.0.8/src/upnp_device.c:207:39: [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). && strncmp("A_ARG_TYPE_", name, strlen("A_ARG_TYPE_")) != 0) { data/gmrender-resurrect-0.0.8/src/upnp_device.c:430:3: [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(kRetryTimeMs * 1000); data/gmrender-resurrect-0.0.8/src/upnp_device.c:462:15: [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). buf, strlen(buf), 1, data/gmrender-resurrect-0.0.8/src/upnp_transport.c:579:39: [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). const char *tracks = (uri != NULL && strlen(uri) > 0) ? "1" : "0"; data/gmrender-resurrect-0.0.8/src/upnp_transport.c:584:45: [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). const int requires_stream_meta_callback = (strlen(meta) == 0) data/gmrender-resurrect-0.0.8/src/upnp_transport.c:591:39: [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). const char *tracks = (uri != NULL && strlen(uri) > 0) ? "1" : "0"; data/gmrender-resurrect-0.0.8/src/upnp_transport.c:608:7: [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(get_var(TRANSPORT_VAR_AV_URI)) == 0) { data/gmrender-resurrect-0.0.8/src/upnp_transport.c:635: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). if (meta->title == NULL || strlen(meta->title) == 0) { data/gmrender-resurrect-0.0.8/src/upnp_transport.c:775:3: [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); // 500ms data/gmrender-resurrect-0.0.8/src/webserver.c:78:15: [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). entry->len = strlen(contents); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 6777 in approximately 0.19 seconds (35720 lines/second) Physical Source Lines of Code (SLOC) = 4755 Hits@level = [0] 20 [1] 19 [2] 25 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 68 [1+] 48 [2+] 29 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 14.3007 [1+] 10.0946 [2+] 6.09884 [3+] 0.84122 [4+] 0.84122 [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.