From a4828c12b3ad2c68259b8a8976172bbbc292eedd Mon Sep 17 00:00:00 2001 From: wiz Date: Thu, 2 May 2002 13:43:29 +0000 Subject: [PATCH] Fix segfaults when last argument does not exist as suggested in bin/16565 by Ryan Younce. --- usr.bin/asa/asa.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.bin/asa/asa.c b/usr.bin/asa/asa.c index 626712da39b7..3cf285068b41 100644 --- a/usr.bin/asa/asa.c +++ b/usr.bin/asa/asa.c @@ -1,4 +1,4 @@ -/* $NetBSD: asa.c,v 1.12 2002/05/02 13:40:50 wiz Exp $ */ +/* $NetBSD: asa.c,v 1.13 2002/05/02 13:43:29 wiz Exp $ */ /* * Copyright (c) 1993,94 Winning Strategies, Inc. @@ -32,7 +32,7 @@ #include #ifndef lint -__RCSID("$NetBSD: asa.c,v 1.12 2002/05/02 13:40:50 wiz Exp $"); +__RCSID("$NetBSD: asa.c,v 1.13 2002/05/02 13:43:29 wiz Exp $"); #endif #include @@ -55,13 +55,15 @@ main (int argc, char *argv[]) if (*argv) { if (!(fp = fopen(*argv, "r"))) { warn ("%s", *argv); + ++argv; continue; } + ++argv; } asa(fp); if (fp != stdin) (void)fclose(fp); - } while (*argv++); + } while (*argv); exit(0); }