From 61e0b6eaf4d98ddea540ebbf6b7ad7202ffc6786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= Date: Sat, 26 Apr 2014 09:41:04 +0000 Subject: [PATCH 19/42] btrfs-progs: fix mkfs.btrfs segfault with --features option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mkfs.btrfs --features long option takes an argument but does not declare it. Consequently getopt does not allocate an argument, which makes an unconditional strdup() crash during options parsing. Fix by declaring the argument in the options alias array. Signed-off-by: Holger Hoffstätte Signed-off-by: David Sterba --- mkfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkfs.c b/mkfs.c index 4f5ee07e5ef9..16e92221a547 100644 --- a/mkfs.c +++ b/mkfs.c @@ -350,7 +350,7 @@ static struct option long_options[] = { { "version", 0, NULL, 'V' }, { "rootdir", 1, NULL, 'r' }, { "nodiscard", 0, NULL, 'K' }, - { "features", 0, NULL, 'O' }, + { "features", 1, NULL, 'O' }, { NULL, 0, NULL, 0} }; -- 1.9.0