From 06ef8a4e0974aa152c8d3eea855522de4c89b8e9 Mon Sep 17 00:00:00 2001 From: derselbst Date: Fri, 1 Feb 2019 13:10:52 +0100 Subject: [PATCH] fluid_is_midifile(): only accept regular files --- src/bindings/fluid_filerenderer.c | 2 +- src/midi/fluid_midi.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/bindings/fluid_filerenderer.c b/src/bindings/fluid_filerenderer.c index 6882a4b9..8afc89fb 100644 --- a/src/bindings/fluid_filerenderer.c +++ b/src/bindings/fluid_filerenderer.c @@ -298,7 +298,7 @@ new_fluid_file_renderer(fluid_synth_t *synth) sf_command(dev->sndfile, SFC_SET_NORM_FLOAT, NULL, SF_TRUE); #else - dev->file = fopen(filename, "wb"); + dev->file = FLUID_FOPEN(filename, "wb"); if(dev->file == NULL) { diff --git a/src/midi/fluid_midi.c b/src/midi/fluid_midi.c index 1a394f81..eb3d7e57 100644 --- a/src/midi/fluid_midi.c +++ b/src/midi/fluid_midi.c @@ -102,6 +102,13 @@ int fluid_is_midifile(const char *filename) { return retcode; } + + // file exists and we have permission to open it + // now, test whether it's acutally a regular file or a symlink to such + if(!fluid_file_test(filename, G_FILE_TEST_IS_REGULAR)) + { + break; + } if(FLUID_FREAD(&id, sizeof(id), 1, fp) != 1) {