gpt: add overflow check for lba_first

This commit is contained in:
Michael Shaw 2023-10-18 15:31:30 -04:00
commit 57d9a4164f

View file

@ -55,6 +55,9 @@ void block_gpt_init(struct block_device *dev)
used_count++; used_count++;
if(entries[i].lba_first > dev->block_count)
continue;
/* Name and register the partition */ /* Name and register the partition */
char *buf = kzalloc(64, ALLOC_KERN); char *buf = kzalloc(64, ALLOC_KERN);
snprintf(buf, "%sp%d", 63, dev->name, used_count - 1); snprintf(buf, "%sp%d", 63, dev->name, used_count - 1);