New checks for an oversized 0xEE protective (or any hybrid MBR)
partition. Auto-corrects on loading if protective & otherwise valid;
if not, verify and save operations warn of the problem.
diff --git a/NEWS b/NEWS
index 47c3a80..35a9902 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,21 @@
 0.8.9 (??/??/2014):
 -------------------
 
+- Added check for an oversized 0xEE protective partition. The program now
+  auto-repairs this condition on loading if the GPT data seem otherwise
+  valid. This is done because I've been receiving reports of some disks
+  (possibly from some OEM Windows 8 loads) that violate the GPT spec in
+  this way, and gdisk was reporting write errors when saving data.
+
+- If the GPT data seem to be damaged in some way or if the disk seems to
+  be a hybrid MBR and if the MBR partition(s) don't fit on the disk, the
+  verify (v) function now warns of this condition, and writing the disk if
+  it exists also displays a more specific error message about the problem.
+
+- Added new type codes (3000, 7412F7D5-A156-4B13-81DC-867174929325 and
+  3001, D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149) for Open Network Install
+  Environment (ONIE) boot and config partitions, respectively.
+
 - Added new type ccde (ED01, BFBFAFE7-A34F-448A-9A5B-6213EB736C22), for
   Lenovo's ESP-like partition.
 
diff --git a/gpt.cc b/gpt.cc
index 23e1bb2..fa7b661 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -291,6 +291,12 @@
    // Verify that partitions don't run into GPT data areas....
    problems += CheckGPTSize();
 
+   if (!protectiveMBR.DoTheyFit()) {
+      cout << "\nPartition(s) in the protective MBR are too big for the disk! Creating a\n"
+           << "fresh protective or hybrid MBR is recommended.\n";
+      problems++;
+   }
+
    // Check that partitions are aligned on proper boundaries (for WD Advanced
    // Format and similar disks)....
    for (i = 0; i < numParts; i++) {
@@ -681,6 +687,15 @@
    // Load the GPT data, whether or not it's valid
    ForceLoadGPTData();
 
+   // Some tools create a 0xEE partition that's too big. If this is detected,
+   // normalize it....
+   if ((state == gpt_valid) && !protectiveMBR.DoTheyFit() && (protectiveMBR.GetValidity() == gpt)) {
+      if (!beQuiet) {
+         cerr << "\aThe protective MBR's 0xEE partition is oversized! Auto-repairing.\n\n";
+      } // if
+      protectiveMBR.MakeProtectiveMBR();
+   } // if
+
    if (!beQuiet) {
       cout << "Partition table scan:\n";
       protectiveMBR.ShowState();
@@ -1056,6 +1071,12 @@
       cerr << "Aborting write operation!\n";
    } // if
 
+   // Check that protective MBR fits, and warn if it doesn't....
+   if (!protectiveMBR.DoTheyFit()) {
+      cerr << "\nPartition(s) in the protective MBR are too big for the disk! Creating a\n"
+           << "fresh protective or hybrid MBR is recommended.\n";
+   }
+
    // Check for mismatched MBR and GPT data, but let it pass if found
    // (function displays warning message)
    FindHybridMismatches();
diff --git a/support.h b/support.h
index 27d6e63..3dba44f 100644
--- a/support.h
+++ b/support.h
@@ -8,7 +8,7 @@
 #ifndef __GPTSUPPORT
 #define __GPTSUPPORT
 
-#define GPTFDISK_VERSION "0.8.8"
+#define GPTFDISK_VERSION "0.8.8.2"
 
 #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__)
 // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64