Source-Changes-HG archive

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

[src/trunk]: src/external/historical/nawk/dist avoid crash if certain operati...



details:   https://anonhg.NetBSD.org/src/rev/94caa7b8c584
branches:  trunk
changeset: 761218:94caa7b8c584
user:      drochner <drochner%NetBSD.org@localhost>
date:      Thu Jan 20 21:23:11 2011 +0000

description:
avoid crash if certain operations are done before an input record is
read, ie in a BEGIN rule

diffstat:

 external/historical/nawk/dist/lib.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r 68f451687a8b -r 94caa7b8c584 external/historical/nawk/dist/lib.c
--- a/external/historical/nawk/dist/lib.c       Thu Jan 20 19:51:54 2011 +0000
+++ b/external/historical/nawk/dist/lib.c       Thu Jan 20 21:23:11 2011 +0000
@@ -328,7 +328,9 @@
        }
        fr = fields;
        i = 0;  /* number of fields accumulated here */
-       if (inputFS[0] && inputFS[1]) { /* it's a regular expression */
+       if (!inputFS) {
+               /* do nothing */
+       } else if (inputFS[0] && inputFS[1]) {  /* it's a regular expression */
                i = refldbld(r, inputFS);
        } else if ((sep = *inputFS) == ' ') {   /* default whitespace */
                for (i = 0; ; ) {



Home | Main Index | Thread Index | Old Index