freebsd-dev/gnu
Bill Paul a13bb127d2 Aw c'mon. I'm being driven mad by plenty of other things. I don't
need this.

Consider the following code:

	case 'O':
		output_filename = malloc(strlen(arg)+4);
		strcpy(output_filename, arg);
		strcat(output_filename, ".tmp");
		real_output_filename = arg;
		return;

The idea here is to malloc() a buffer big enough to hold the name of
a supplied file name, plus ".tmp". So we malloc() 'size of filename'
bytes plus 4, right? Wrong! ".tmp" is _FIVE_ bytes long! There's a
traling '\0' which strcat() gleefully tacks on _outside_ the bounds
of the buffer. Result: program corrupts own memory. Program SEGVs at
seemingly random times. Bill not like random SEGVs. Bill smash.

Know how I found this? I've been trying to bootstrap -current on my
2.1.0-RELEASE machine at work and I couldn't seem to get libc.a built
because the linker would intermittently blow chunks while executing
things like 'ld -O foo.o -X -r foo.o'. Since this is an initial
bootstrap version of ld, it was linked against the 2.1.0 libc, who's
malloc() behaves differently than that in -current.

Presumeably ld -O doesn't blow up in -current, otherwise someone would
have spotted this already. I don't know if this is a bug or a feature.

Anyway. I'm changing the strlen(arg)+4 to strlen(arg)+5. Bah.
1996-06-08 04:52:57 +00:00
..
gnu2bmake recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
include Change install' to ${INSTALL}' so that default install flags can be 1995-08-06 12:24:38 +00:00
lib Make rules reentrant. 1996-05-28 00:34:38 +00:00
libexec Correct some manual page cross reference errors. E.g. su is a section 1996-02-02 00:26:12 +00:00
usr.bin Aw c'mon. I'm being driven mad by plenty of other things. I don't 1996-06-08 04:52:57 +00:00
usr.sbin Toss the GNU yp_mkdb into the attic. 1996-04-28 04:08:22 +00:00
COPYING Updated GNU utilities 1993-06-18 04:22:21 +00:00
COPYING.LIB Adding GPL docs, make structure. 1993-06-18 06:05:45 +00:00
Makefile Remove games from the SUBDIR list. Gnu Chess is in ports now. 1995-12-23 17:03:07 +00:00