From a9e244d4da0f1153381b9410b2c7eada6d6ef52c Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 16 Mar 2018 11:23:54 +0100 Subject: Fix segfault when memtool is called without arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: a7e2f45e6d8e ("Implement a -V switch to get the version") Signed-off-by: Uwe Kleine-König --- memtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memtool.c b/memtool.c index c095550..16da84d 100644 --- a/memtool.c +++ b/memtool.c @@ -480,7 +480,7 @@ int main(int argc, char **argv) argv++; argc--; - if (!strcmp(argv[0], "-V")) { + if (argc > 0 && !strcmp(argv[0], "-V")) { printf("%s\n", PACKAGE_STRING); return EXIT_SUCCESS; } -- cgit v1.2.3