fluid_is_midifile(): only accept regular files

This commit is contained in:
derselbst 2019-02-01 13:10:52 +01:00
parent 64c90a6c49
commit 06ef8a4e09
2 changed files with 8 additions and 1 deletions

View File

@ -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)
{

View File

@ -103,6 +103,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)
{
break;