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/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.h Examining data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c Examining data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c Examining data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.c Examining data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.h Examining data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c FINAL RESULTS: data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1030:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(title, "%s - Select SoundFont", tag); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1072:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(title, "%s Notice", tag); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1143:13: [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(tag, instance_tag); data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c:510:5: [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, 256, fmt, args); data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.c:40:29: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define FLUID_LOG(E, X...) fprintf(stderr, X) data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.c:2023:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:54:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/sf2:%s", home, DEFAULT_SF2PATH); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:61:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s:%s", projectDirectory, origPath); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:77:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(eltpath, "%s/%s", element, filename); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:117:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s/sf2:%s", home, DEFAULT_SF2PATH); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:124:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(path, "%s:%s", projectDirectory, origPath); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:47:15: [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. sf2path = getenv("SF2_PATH"); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:50:15: [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. char *home = getenv("HOME"); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:110:15: [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. sf2path = getenv("SF2_PATH"); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:113:15: [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. char *home = getenv("HOME"); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:122: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 buffer[256]; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:255:24: [2] (integer) atol: 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 new_poly = atol(&argv[1]->s); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:383:13: [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[PATH_MAX]; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:488: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 buffer[10]; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:507: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 buffer[10]; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:572: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. unsigned char midi[4]; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:631: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 bank[6], program[4], name[31]; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:632: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 *data[3] = { bank, program, name }; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1133: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 tag[50]; data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1137:9: [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(tag, "FluidSynth-DSSI"); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1163: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. static char *test_argv[5] = { NULL, NULL, "-", "-", "FluidSynth-DSSI" }; data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c:507: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 buffer[256]; data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c:611:31: [2] (integer) atol: 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). float new_polyphony = atol(value); data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c:910: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(instances[i]->output_l, data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c:913: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(instances[i]->output_r, data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c:1007: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(instances[i]->output_l + samples_done, data/fluidsynth-dssi-1.0.0/src/fluidsynth-dssi.c:1010: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(instances[i]->output_r + samples_done, data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.c:301: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 name[21]; /* Name of sample */ data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.c:323: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 name[21]; /* Name of instrument */ data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.c:648:14: [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 (!(fd = fopen (fname, "rb"))) data/fluidsynth-dssi-1.0.0/src/load_soundfont_metadata.h:57: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. char name[21]; /* preset name */ data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:382:31: [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 (project_directory[strlen(project_directory) - 1] != '/') { data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:670:31: [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 (sfpreset->name && strlen(sfpreset->name) > 0) { data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:671:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, sfpreset->name, 31); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1029:28: [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). title = (char *)malloc(strlen(tag) + 20); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1071:28: [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). title = (char *)malloc(strlen(tag) + 8); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1136:9: [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(instance_tag) == 0) { data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1140: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(instance_tag) > 49) { data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1141:55: [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). snprintf(tag, 50, "...%s", instance_tag + strlen(instance_tag) - 46); /* hope the unique info is at the end */ data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1146: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(instance_tag) > 33) { data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1147:71: [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). snprintf(tag, 50, "FluidSynth-DSSI ...%s", instance_tag + strlen(instance_tag) - 30); data/fluidsynth-dssi-1.0.0/src/FluidSynth-DSSI_gtk.c:1215: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). osc_self_url = osc_build_path(tmp_url, (strlen(path) > 1 ? path + 1 : path)); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:53:28: [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). path = (char *)malloc(strlen(DEFAULT_SF2PATH) + strlen(home) + 6); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:53:54: [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). path = (char *)malloc(strlen(DEFAULT_SF2PATH) + strlen(home) + 6); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:60: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). path = (char *)malloc(strlen(origPath) + strlen(projectDirectory) + 2); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:60:43: [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). path = (char *)malloc(strlen(origPath) + strlen(projectDirectory) + 2); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:76: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). eltpath = (char *)malloc(strlen(element) + strlen(filename) + 2); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:76: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). eltpath = (char *)malloc(strlen(element) + strlen(filename) + 2); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:116:28: [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). path = (char *)malloc(strlen(DEFAULT_SF2PATH) + strlen(home) + 6); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:116:54: [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). path = (char *)malloc(strlen(DEFAULT_SF2PATH) + strlen(home) + 6); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:123: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). path = (char *)malloc(strlen(origPath) + strlen(projectDirectory) + 2); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:123:43: [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). path = (char *)malloc(strlen(origPath) + strlen(projectDirectory) + 2); data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:147:10: [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(entry->d_name) > 4 && data/fluidsynth-dssi-1.0.0/src/locate_soundfont.c:148:31: [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). !strcasecmp(entry->d_name + strlen(entry->d_name) - 4, ".sf2")) { ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 4880 in approximately 0.17 seconds (29523 lines/second) Physical Source Lines of Code (SLOC) = 3606 Hits@level = [0] 17 [1] 23 [2] 21 [3] 4 [4] 11 [5] 0 Hits@level+ = [0+] 76 [1+] 59 [2+] 36 [3+] 15 [4+] 11 [5+] 0 Hits/KSLOC@level+ = [0+] 21.076 [1+] 16.3616 [2+] 9.98336 [3+] 4.15973 [4+] 3.05047 [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.