freebsd-skq/gnu/usr.bin/ld
wpaul d879c0ae3d 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
..
i386 Changed the terminology for what used to be called the "memorizing" 1995-11-02 18:48:15 +00:00
ldconfig Correct some man page xrefs, and some other minor changes to bring some 1996-04-08 04:18:31 +00:00
ldd Updated to recent version of Paul K.'s shlib code. This code has better 1994-12-23 22:31:35 +00:00
rtld When checking to see whether a needed shared library has already 1996-05-22 06:34:12 +00:00
sparc Weak symbol support from NetBSD. This should bring us in sync with the 1995-03-04 17:49:20 +00:00
cplus-dem.c Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
etc.c Changes from Paul Kranenburg which bring us into sync with his sources: 1994-06-15 22:41:19 +00:00
ld.1 Add an option -O <filename> to ld. From the manpage: 1996-05-28 16:17:48 +00:00
ld.1aout Add an option -O <filename> to ld. From the manpage: 1996-05-28 16:17:48 +00:00
ld.c Aw c'mon. I'm being driven mad by plenty of other things. I don't 1996-06-08 04:52:57 +00:00
ld.h Implement support for LD_PRELOAD in the dynamic linker. 1996-04-20 18:27:56 +00:00
lib.c Fix checks for open() failing. open() may successfully return 0. 1995-09-28 19:43:22 +00:00
Makefile Stop using gnumalloc. 1995-09-22 14:14:32 +00:00
PORTING New file from pk to aid new in developing the shlib code for new 1994-12-23 22:56:08 +00:00
rrs.c Zero out an unused field in a structure that is written to the output 1996-05-27 18:06:02 +00:00
shlib.c Implement support for LD_PRELOAD in the dynamic linker. 1996-04-20 18:27:56 +00:00
symbol.c Updated to recent version of Paul K.'s shlib code. This code has better 1994-12-23 22:31:35 +00:00
symseg.h Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
warnings.c Weak symbol support from NetBSD. This should bring us in sync with the 1995-03-04 17:49:20 +00:00
xbits.c This is Paul K's latest set of ld changes. A commit was necessary at this 1994-02-13 20:43:13 +00:00