History

stream_bluray: check fread return value

llyyr committed 2 years ago

Commit daa60681 parent f89d0d41 file · +10 −8Browse files

Unified · Split

stream/stream_bluray.c+10−8
@@ -551,16 +551,18 @@ static bool check_bdmv(const char *path) · 550 unmodified lines
551551 if (!temp)
552552 return false;
553553
554− char data[50] = {0};
554+ char data[50];
555+ bool ret = false;
556+
557+ if (fread(data, 50, 1, temp) == 1) {
558+ bstr bdata = {data, 50};
559+ ret = bstr_startswith0(bdata, "MOBJ0100") || // AVCHD
560+ bstr_startswith0(bdata, "MOBJ0200") || // Blu-ray
561+ bstr_startswith0(bdata, "MOBJ0300"); // UHD BD
562+ }
555563
556− fread(data, 50, 1, temp);
557564 fclose(temp);
558−
559− bstr bdata = {data, 50};
560−
561− return bstr_startswith0(bdata, "MOBJ0100") || // AVCHD
562− bstr_startswith0(bdata, "MOBJ0200") || // Blu-ray
563− bstr_startswith0(bdata, "MOBJ0300"); // UHD BD
565+ return ret;
564566 }
565567
566568 // Destructively remove the current trailing path component.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t