stream_bluray: check fread return value

This commit is contained in:
llyyr 2024-07-09 02:25:54 +05:30 committed by Kacper Michajłow
parent f89d0d48bc
commit daa6068d02
1 changed files with 10 additions and 8 deletions

View File

@ -551,18 +551,20 @@ static bool check_bdmv(const char *path)
if (!temp)
return false;
char data[50] = {0};
fread(data, 50, 1, temp);
fclose(temp);
char data[50];
bool ret = false;
if (fread(data, 50, 1, temp) == 1) {
bstr bdata = {data, 50};
return bstr_startswith0(bdata, "MOBJ0100") || // AVCHD
ret = bstr_startswith0(bdata, "MOBJ0100") || // AVCHD
bstr_startswith0(bdata, "MOBJ0200") || // Blu-ray
bstr_startswith0(bdata, "MOBJ0300"); // UHD BD
}
fclose(temp);
return ret;
}
// Destructively remove the current trailing path component.
static void remove_prefix(char *path)
{