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/gom-0.30.2/src/gom_driver.h Examining data/gom-0.30.2/src/gom_mixer.h Examining data/gom-0.30.2/src/gom_gomii.h Examining data/gom-0.30.2/src/gom_file.h Examining data/gom-0.30.2/src/gom_action.h Examining data/gom-0.30.2/src/gom_iface.h Examining data/gom-0.30.2/src/gom_info.c Examining data/gom-0.30.2/src/gom_driver_oss.c Examining data/gom-0.30.2/src/gom_mixer.c Examining data/gom-0.30.2/src/gom_gomii.c Examining data/gom-0.30.2/src/gom_file.c Examining data/gom-0.30.2/src/gom_action.c Examining data/gom-0.30.2/src/gom_iface_c.c Examining data/gom-0.30.2/src/gom_iface_t.c Examining data/gom-0.30.2/src/gom_iface_x.c Examining data/gom-0.30.2/src/gom.c Examining data/gom-0.30.2/src/gom.h Examining data/gom-0.30.2/src/gom_info.h FINAL RESULTS: data/gom-0.30.2/src/gom_info.c:133:3: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(new_fmt, fmt, GOM_INFO_FMT_SIZE); data/gom-0.30.2/src/gom_info.c:161:4: [5] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is high; the length parameter appears to be a constant, instead of computing the number of characters left. strncat(line, " ", GOM_INFO_BLOCK_LINE_SIZE-1); data/gom-0.30.2/src/gom_action.c:323: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(shortopts_copy, shortopts); data/gom-0.30.2/src/gom_action.c:413: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(line_copy, line); data/gom-0.30.2/src/gom_action.c:424: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(line_copy, line); data/gom-0.30.2/src/gom_action.c:428: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(line_copy, line); data/gom-0.30.2/src/gom_action.c:862:17: [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. execute_err = system(local_optarg); data/gom-0.30.2/src/gom_iface_x.c:164:3: [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(line, 255, fmt, vargs); data/gom-0.30.2/src/gom_info.c:104:2: [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(output_stream, fmt, vargs); data/gom-0.30.2/src/gom_action.c:350:11: [3] (buffer) getopt_long: 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. action = getopt_long(argc, argv, gom_action_shortopts(), gom_options, &option_index); data/gom-0.30.2/src/gom_action.c:352:11: [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. action = getopt(argc, argv, gom_action_shortopts()); data/gom-0.30.2/src/gom_file.c:80:26: [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 (fname[0] == '~' && getenv("HOME") != NULL) data/gom-0.30.2/src/gom_file.c:82:23: [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. gom_file_fncat(fn, getenv("HOME")); data/gom-0.30.2/src/gom_file.c:102:8: [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("HOME") != NULL) data/gom-0.30.2/src/gom_file.c:105:24: [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. gom_file_fncat(fn, getenv("HOME")); data/gom-0.30.2/src/gom_action.c:316: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. static char shortopts[120] = ""; data/gom-0.30.2/src/gom_action.c:317: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 shortopts_copy[120] = ""; data/gom-0.30.2/src/gom_action.c:404: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 line[GOM_HELP_OPTION_LINE_SIZE]; data/gom-0.30.2/src/gom_action.c:405: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 line_copy[GOM_HELP_OPTION_LINE_SIZE]; data/gom-0.30.2/src/gom_action.c:922:46: [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). gom_info_verbosity_set(GOM_INFO_NORMAL, atoi(local_optarg)); data/gom-0.30.2/src/gom_driver_oss.c:60: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 fn[GOM_DEVICE_FILE_SIZE]; /* mixer device _f_ile _n_ame */ data/gom-0.30.2/src/gom_driver_oss.c:170:24: [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). else if ((new_mixer = open(device_file, O_RDWR)) == -1) data/gom-0.30.2/src/gom_driver_oss.c:268: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 * channel_name[GOM_DRIVER_CHANNELS] = SOUND_DEVICE_NAMES; data/gom-0.30.2/src/gom_driver_oss.c:269: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 * channel_label[GOM_DRIVER_CHANNELS] = SOUND_DEVICE_LABELS; data/gom-0.30.2/src/gom_file.c:41: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 gom_file_option[GOM_FILE_OPT_SIZE]; data/gom-0.30.2/src/gom_file.c:59: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 * gom_file_fncat(char fn[FILENAME_MAX], const char * ct) data/gom-0.30.2/src/gom_file.c:59:23: [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 * gom_file_fncat(char fn[FILENAME_MAX], const char * ct) data/gom-0.30.2/src/gom_file.c:67: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. char fn[FILENAME_MAX], data/gom-0.30.2/src/gom_file.c:256: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 fn_user[FILENAME_MAX]; data/gom-0.30.2/src/gom_file.c:257: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 fn_sys[FILENAME_MAX]; data/gom-0.30.2/src/gom_file.c:263:11: [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(fn_user, "r")) == NULL) data/gom-0.30.2/src/gom_file.c:267:12: [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(fn_sys, "r")) == NULL) data/gom-0.30.2/src/gom_file.c:376: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 fn[FILENAME_MAX]; data/gom-0.30.2/src/gom_file.c:391:30: [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). else if (!overwrite && (f = fopen(fn, "r")) != NULL) /* open absolute given file */ data/gom-0.30.2/src/gom_file.c:398:16: [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). else if ((f = fopen(fn, "w")) == NULL) /* open relative given file */ data/gom-0.30.2/src/gom_gomii.c:150: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. static char last_refresh_string[30]; data/gom-0.30.2/src/gom_iface_t.c:177: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. static char option_arg[100] = ""; data/gom-0.30.2/src/gom_iface_x.c:162: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 line[255]; data/gom-0.30.2/src/gom_iface_x.c:195:10: [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 option_arg[100]; data/gom-0.30.2/src/gom_info.c:124: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 new_fmt[GOM_INFO_FMT_SIZE]; data/gom-0.30.2/src/gom_info.c:149: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 line[GOM_INFO_BLOCK_LINE_SIZE]; data/gom-0.30.2/src/gom_action.c:320:2: [1] (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 character. strcpy(shortopts, ""); data/gom-0.30.2/src/gom_driver_oss.c:156:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(gom_driver_oss.c.fn, GOM_DEVICE_NOT_OPENED_TEXT, GOM_DEVICE_FILE_SIZE); data/gom-0.30.2/src/gom_driver_oss.c:214:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(gom_driver_oss.c.fn, device_file, GOM_DEVICE_FILE_SIZE); data/gom-0.30.2/src/gom_file.c:61: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(ct) > FILENAME_MAX-strlen(fn)-1) data/gom-0.30.2/src/gom_file.c:61: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 (strlen(ct) > FILENAME_MAX-strlen(fn)-1) data/gom-0.30.2/src/gom_file.c:63:9: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. return strncat(fn, ct, FILENAME_MAX-strlen(fn)-1); data/gom-0.30.2/src/gom_file.c:63:38: [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 strncat(fn, ct, FILENAME_MAX-strlen(fn)-1); data/gom-0.30.2/src/gom_file.c:139: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). gom_file_fncat(fn, (fname == NULL) || (strlen(fname) == 0) ? GOM_OPTIONS_FILE_DEFAULT : fname); data/gom-0.30.2/src/gom_file.c:155: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(gom_file_option) < 2) data/gom-0.30.2/src/gom_file.c:384:58: [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 ((fname != NULL) && (strncmp(fname, GOM_CONFIG_FILE, strlen(GOM_CONFIG_FILE)) == 0)) data/gom-0.30.2/src/gom_iface_t.c:118:25: [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). mvprintw(line, (COLS - strlen(str)) / 2, str); data/gom-0.30.2/src/gom_iface_t.c:414:3: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/gom-0.30.2/src/gom_iface_t.c:425:3: [1] (buffer) getchar: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). getchar(); data/gom-0.30.2/src/gom_iface_t.c:507: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). COLS-strlen(gom_gomii_last_refresh_str())-3, " %s ", data/gom-0.30.2/src/gom_iface_x.c:199:3: [1] (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 character. strcpy(option_arg, ""); data/gom-0.30.2/src/gom_iface_x.c:211:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(option_arg, string, 100); data/gom-0.30.2/src/gom_info.c:132:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(new_fmt, (kind == GOM_INFO_ERROR) ? "gom ERROR: " : "gom: ", GOM_INFO_FMT_SIZE); data/gom-0.30.2/src/gom_info.c:159:3: [1] (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 character. strcpy(line, ""); data/gom-0.30.2/src/gom_info.c:164:3: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(line, string, block_width); data/gom-0.30.2/src/gom_info.c:168: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(string) > block_width) data/gom-0.30.2/src/gom_mixer.c:238:4: [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(micro_seconds_to_sleep); ANALYSIS SUMMARY: Hits = 62 Lines analyzed = 5008 in approximately 0.19 seconds (26625 lines/second) Physical Source Lines of Code (SLOC) = 3021 Hits@level = [0] 36 [1] 21 [2] 26 [3] 6 [4] 7 [5] 2 Hits@level+ = [0+] 98 [1+] 62 [2+] 41 [3+] 15 [4+] 9 [5+] 2 Hits/KSLOC@level+ = [0+] 32.4396 [1+] 20.523 [2+] 13.5717 [3+] 4.96524 [4+] 2.97915 [5+] 0.662032 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.