[PATCH 9/9] agetty: fix invalid usage crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



$ agetty
agetty: not enough arguments: Success
Segmentation fault (core dumped)

Reference: 9325dbfd2018b2a3b510617f4aa13777fbbe23c3
Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 term-utils/agetty.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index f06b9fc6e..d9e9548fa 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -803,7 +803,8 @@ static void parse_args(int argc, char **argv, struct options *op)
 
 	if (argc < optind + 1) {
 		log_warn(_("not enough arguments"));
-		warn(_("not enough arguments"));
+		warnx(_("not enough arguments"));
+		errtryhelp(EXIT_FAILURE);
 	}
 
 	/* Accept "tty", "baudrate tty", and "tty baudrate". */
@@ -812,7 +813,8 @@ static void parse_args(int argc, char **argv, struct options *op)
 		parse_speeds(op, argv[optind++]);
 		if (argc < optind + 1) {
 			log_warn(_("not enough arguments"));
-			warn(_("not enough arguments"));
+			warnx(_("not enough arguments"));
+			exit(EXIT_FAILURE);
 		}
 		op->tty = argv[optind++];
 	} else {
-- 
2.13.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux