gptfdisk: fix buffer overrun
am: 7404144dd9

Change-Id: I7eb316c1ee9b5ea3ad056f0b1caacf8858abf28c
diff --git a/android_popt.cc b/android_popt.cc
index b5b7970..98b7f99 100644
--- a/android_popt.cc
+++ b/android_popt.cc
@@ -29,8 +29,10 @@
     for (; options[count].longName; count++) {
     }
 
+    // getopt_long expects the last element to be null
+    // so allocate count + 1
     struct option *long_options = (struct option *)
-            calloc(count, sizeof(struct option));
+            calloc(count + 1, sizeof(struct option));
     for (int i = 0; options[i].longName; i++) {
         long_options[i].name = options[i].longName;
         long_options[i].flag = 0;