Skip to content

Commit

Permalink
libbluray: fix a possible out of bounds read on macOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
galad87 committed Dec 22, 2019
1 parent 3b5993b commit e9655e9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions contrib/libbluray/P03-darwin-mount.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/src/file/mount_darwin.c b/src/file/mount_darwin.c
index f7abb1a..394437a 100644
--- a/src/file/mount_darwin.c
+++ b/src/file/mount_darwin.c
@@ -45,11 +45,15 @@ char *mount_get_mountpoint(const char *device_path)
return str_dup(device_path);
}

- struct statfs mbuf[128];
+ struct statfs mbuf[256];
int fs_count;

if ( (fs_count = getfsstat (NULL, 0, MNT_NOWAIT)) != -1 ) {

+ if (fs_count > 256) {
+ fs_count = 256;
+ }
+
getfsstat (mbuf, fs_count * sizeof(mbuf[0]), MNT_NOWAIT);

for ( int i = 0; i < fs_count; ++i) {

0 comments on commit e9655e9

Please sign in to comment.