From cb6b0d2c0e8835d360f85384d3eef53fcc17dc5a Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 3 Aug 2021 22:22:02 -0400 Subject: disk.c ensure a valid volume is returned from get_free_volume() volume is used for element math and indexing into buffers -1 volume is bad Change-Id: I1ec75ef3a848c154ea80905224ea9a3a14bf8151 --- firmware/common/disk.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'firmware/common') diff --git a/firmware/common/disk.c b/firmware/common/disk.c index 51d033b678..c096878e86 100644 --- a/firmware/common/disk.c +++ b/firmware/common/disk.c @@ -174,6 +174,13 @@ int disk_mount(int drive) int volume = get_free_volume(); + if (volume < 0) + { + DEBUGF("No Free Volumes\n"); + disk_writer_unlock(); + return 0; + } + if (!disk_init(IF_MD(drive))) { disk_writer_unlock(); -- cgit v1.2.3