Skip to contentSkip to conversation

btrfs-progs: fix mkfs.btrfs segfault with --features option

PATCH New Holger Hoffstätte 1 participant 1 message Apr 26, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: fix mkfs.btrfs segfault with --features option

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.

---
 mkfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mkfs.c +1 -1
index dbd83f5..173972c 100644
@@ -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}
 };
 
Signature · 1 line
1.9.2