mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
Fix GPT signature test
gpt.Signature is not a null-terminated string, but an 8-byte character array. Using `strcmp` will not provide a valid result. Use `strncmp` over the first 8 bytes instead. Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
This commit is contained in:
parent
686ad14308
commit
c1c8c5a7dd
1 changed files with 1 additions and 1 deletions
|
@ -166,7 +166,7 @@ DeviceWrapperFatPartition *DeviceWrapper::fatPartition(int nr)
|
||||||
struct gpt_partition gptpart;
|
struct gpt_partition gptpart;
|
||||||
pread((char *) &gpt, sizeof(gpt), 512);
|
pread((char *) &gpt, sizeof(gpt), 512);
|
||||||
|
|
||||||
if (!strcmp("EFI PART", gpt.Signature) && gpt.MyLBA == 1)
|
if (!strncmp("EFI PART", gpt.Signature, 8) && gpt.MyLBA == 1)
|
||||||
{
|
{
|
||||||
qDebug() << "Using GPT partition table";
|
qDebug() << "Using GPT partition table";
|
||||||
if (nr > gpt.NumberOfPartitionEntries)
|
if (nr > gpt.NumberOfPartitionEntries)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue