From 821399c6be223313597ffbae71d77f4f1adc7595 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 15 May 2018 19:39:05 -0400 Subject: [PATCH] fix access violation when --debug:xxxx has no other args after it --- sys/share/pcmain.c | 2 +- sys/unix/unixmain.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index c7d275071..1b38ab951 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -343,7 +343,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/ argv++; } - if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { + if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { /* avoid matching "-dec" for DECgraphics; since the man page * says -d directory, hope nobody's using -desomething_else */ diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index 3c91b3e55..f798fa163 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -119,7 +119,7 @@ char *argv[]; argv++; } - if (!strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { + if (argc > 1 && !strncmp(argv[1], "-d", 2) && argv[1][2] != 'e') { /* avoid matching "-dec" for DECgraphics; since the man page * says -d directory, hope nobody's using -desomething_else */