From f5ef40de83dc47577d0cdbca34a168dc66fb4da7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Wed, 3 Apr 2019 16:32:24 -0700 Subject: [PATCH] Add missing null terminator for getopt_long() getopt_long() assumes an all-zeroes 'struct option' at the end of the array. Add it. Fortunately this isn't causing problems in practice because vold is always passed valid command line options... Test: Running 'vold --foo' no longer segfaults. Change-Id: I2cd3af501cc1aa11327a8062ec492be1d23defdf --- main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cpp b/main.cpp index 687a0a9..accaa01 100644 --- a/main.cpp +++ b/main.cpp @@ -152,6 +152,7 @@ static void parse_args(int argc, char** argv) { {"blkid_untrusted_context", required_argument, 0, 'B'}, {"fsck_context", required_argument, 0, 'f'}, {"fsck_untrusted_context", required_argument, 0, 'F'}, + {nullptr, 0, nullptr, 0}, }; int c;