Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Oct 2002 16:59:30 -0500
From:      "Charles Swiger" <cswiger@mac.com>
To:        <freebsd-stable@FreeBSD.ORG>
Cc:        "Lowell Gilbert" <freebsd-security-local@be-well.no-ip.com>, <bryanf@samurai.com>
Subject:   Re: last cores
Message-ID:  <000701c27ecd$4ba3d9e0$0301a8c0@prime>
References:  <A9ED2106-EABA-11D6-916A-000393013B04@samurai.com> <44smyq9r4m.fsf@be-well.ilk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
From: "Lowell Gilbert" <freebsd-security-local@be-well.no-ip.com>
> Bryan Fullerton <bryanf@samurai.com> writes:
>> Someone might want to look at this.
>>
>> % last -w0
>> Segmentation fault (core dumped)
>>
>> Does this on 4.6.2-RELEASE-p2, 4.7-RELEASE, 4.7-STABLE (Oct 17).
>
> Doesn't belong the -security list, but it looks like the
> backward-compatibility hack in the option-handling switch
> statement of last.c needs another hack.

The example in the getopt(3) manpage should probably be reviewed for
correctness as well.  Bryan, please see whether this helps:

5-sec# diff -w -c last.c_orig last.c
/usr/src/usr.bin/last
*** last.c_orig Mon Oct 28 08:41:16 2002
--- last.c      Mon Oct 28 09:10:18 2002
***************
*** 142,147 ****
--- 143,149 ----
                         * a number after a dash.
                         */
                        if (maxrec == -1) {
+                               if (optind == argc) break;
                                p = argv[optind - 1];
                                if (p[0] == '-' && p[1] == ch && !p[2])
                                        maxrec = atol(++p);

-Chuck


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000701c27ecd$4ba3d9e0$0301a8c0>