*BSD News Article 34334


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!pipex!sunic!trane.uninett.no!eunet.no!nuug!EU.net!Germany.EU.net!news.dfn.de!news.belwue.de!delos.stgt.sub.org!guru.stgt.sub.org!nils
From: nils@guru.stgt.sub.org (Cornelis van der Laan)
Subject: FreeBSD 1.1.5 -- Bug in /usr/bin/leave
Followup-To: comp.os.386bsd.bugs
Reply-To: nils@ims.uni-stuttgart.de
Sender: news@guru.stgt.sub.org (Cornelis van der Laan)
Nntp-Posting-Host: localhost.ims.uni-stuttgart.de
Organization: Mehr Anarchie !
Message-ID: <NILS.94Aug14230659@guru.stgt.sub.org>
Date: Sun, 14 Aug 1994 21:06:58 GMT
Lines: 38


There's a bug in /usr/bin/leave, causing it to not properly handle 
argument times.

Repeat by:
	At 22:50 try to set an alarm for 24:00 (ok, that's not possible, 
	so let's take 23:59).

	leave 2359 responds with: usage: leave [[+]hhmm]

The fix is to insert missing parentheses around a conjunctive condition:

*** leave.c     Sun Aug 14 22:59:58 1994
--- leave.c.orig        Sun Aug 14 22:59:26 1994
***************
*** 97,103 ****
                secs = hours * 60 * 60 + minutes * 60;
        else {
                if (hours > 23 || t->tm_hour > hours ||
!                   t->tm_hour == hours && minutes <= t->tm_min)
                        usage();
                secs = (hours - t->tm_hour) * 60 * 60;
                secs += (minutes - t->tm_min) * 60;
--- 97,103 ----
                secs = hours * 60 * 60 + minutes * 60;
        else {
                if (hours > 23 || t->tm_hour > hours ||
!                   (t->tm_hour == hours && minutes <= t->tm_min))
                        usage();
                secs = (hours - t->tm_hour) * 60 * 60;
                secs += (minutes - t->tm_min) * 60;

Nils
--
----------------------------------------------------------------
Cornelis van der Laan -- nils@ims.uni-stuttgart.de
                      -- nils@guru.stgt.sub.org
# echo Knusper Knusper Knaeuschen > /etc/nologin