From: Rafał Miłecki Date: Sun, 9 Dec 2018 13:22:17 +0000 (+0100) Subject: block: validate amount of arguments for the "autofs" command X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=30f509686d8abc2ffd7fe34401d00cf7a86d8ea9;p=oweals%2Ffstools.git block: validate amount of arguments for the "autofs" command Using argv[3] without checking argc value could result in undefined behavior. It could result in a crash or accessing a NULL that separates argv from envp on UNIX. Signed-off-by: Rafał Miłecki Acked-by: John Crispin --- diff --git a/block.c b/block.c index 46050b4..a0bbf47 100644 --- a/block.c +++ b/block.c @@ -1157,6 +1157,10 @@ static int main_autofs(int argc, char **argv) } return 0; } + + if (argc < 4) + return -EINVAL; + return mount_action(argv[2], argv[3], TYPE_AUTOFS); }