From 00b5ef70e2f400c655b78b107a901fb24eea7ddc Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Tue, 17 Feb 2015 22:31:48 +0000 Subject: setarch: print error when command runs without arguments $ ./setarch Segmentation fault (core dumped) $ coredumpctl gdb ... Program terminated with signal SIGSEGV, Segmentation fault. 301 if (*argv[1] != '-') { Reference: 5edb0ea6bbd57dd916417737f98c9109dc1ecb5b Signed-off-by: Sami Kerola --- sys-utils/setarch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys-utils/setarch.c') diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 76892ab4f..337f8fbaf 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -298,7 +298,7 @@ int main(int argc, char *argv[]) if (archwrapper) arch = program_invocation_short_name; /* symlinks to setarch */ else { - if (*argv[1] != '-') { + if (1 < argc && *argv[1] != '-') { arch = argv[1]; argv[1] = argv[0]; /* for getopt_long() to get the program name */ argv++; -- cgit v1.2.3-55-g7522