Subject: Copy of a bug report... for your info.
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Curt McDowell (914-784-6016 T/L 863) <curt@watson.ibm.com>
List: netbsd-bugs
Date: 01/26/1994 11:51:38
Path: curt
Newsgroups: comp.bugs.4bsd
Distribution: world
Followup-To:
From: curt@watson.ibm.com (Curt McDowell)
Organization: IBM T.J. Watson Research Center
Subject: Bugs in "cal"
Lines: 34
I was just trying to compile "cal" in /usr/src/usr.bin/cal/cal.c
under the IBM AIX operating system, and ran into two major bugs. I
apologize if this has already been reported.
The program I'm looking at is Kim Letkeman's reproduction of the
original "cal", in the following version:
@(#)cal.c 4.8 (Berkeley) 6/1/90
The first bug is that the local variable "month" in main() is
expected to be initialized to 0, but is not. As a result, "cal 1994"
dumps core.
The second bug is that the output strings are not being NUL-
terminated, and therefore there is garbage being printed at the end
of each line. This needs to be fixed in 3 places that I know of.
The first place can be fixed by placing "*p = 0;" before the
trim_trailing_spaces on line 175. The second place can be fixed
by placing:
memset(lineout, ' ', sizeof (lineout));
lineout[sizeof (lineout) - 1] = 0;
immediately before the "for" loop on line 200.
The third place can be fixed by inserting the same code before
the "for" loop on line 235.
+-----------------+-----------------------+-------------------------------+
| Curt McDowell | IBM Watson Research | Power Visualization Systems |
+-----------------+-----------------------+-------------------------------+
------------------------------------------------------------------------------