File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ int disk_open(int drv)
117117 uint32_t gpt_lba = 0 ;
118118 uint8_t sector [GPT_SECTOR_SIZE ] XALIGNED (4 );
119119
120- if ((drv < 0 ) || (drv > MAX_DISKS )) {
120+ if ((drv < 0 ) || (drv >= MAX_DISKS )) {
121121 wolfBoot_printf ("Attempting to access invalid drive %d\r\n" , drv );
122122 return -1 ;
123123 }
@@ -231,11 +231,11 @@ int disk_open(int drv)
231231 */
232232static struct disk_partition * open_part (int drv , int part )
233233{
234- if ((drv < 0 ) || (drv > MAX_DISKS )) {
234+ if ((drv < 0 ) || (drv >= MAX_DISKS )) {
235235 wolfBoot_printf ("Attempting to access invalid drive %d\r\n" , drv );
236236 return NULL ;
237237 }
238- if ((part < 0 ) || (part > MAX_PARTITIONS )) {
238+ if ((part < 0 ) || (part >= MAX_PARTITIONS )) {
239239 wolfBoot_printf ("Attempting to access invalid partition %d\r\n" , part );
240240 return NULL ;
241241 }
@@ -344,7 +344,7 @@ int disk_find_partition_by_label(int drv, const char *label)
344344 struct disk_partition * p ;
345345 int i ;
346346
347- if ((drv < 0 ) || (drv > MAX_DISKS )) {
347+ if ((drv < 0 ) || (drv >= MAX_DISKS )) {
348348 return -1 ;
349349 }
350350 if (Drives [drv ].is_open == 0 ) {
You can’t perform that action at this time.
0 commit comments