Installing Ed-0.2

Estimated build time:           1 minute
Estimated required disk space:  2 MB

Installation of Ed

Ed isn't something you would personally use. It's installed here because it can be used by the patch program if you encounter an ed-based patch file. This happens rarely because diff-based patches are preferred these days.

Install Ed by running the following commands:

cp buf.c buf.c.backup &&
sed 's/int u/int u, sfd/' buf.c.backup | \
���sed '/.*\*mktemp.*/d' | \
���sed 's/.*if (mktemp.*/  sfd = mkstemp(sfn);\
���if ((sfd == -1) || (sfp = fopen (sfn, "w+")) == NULL)/' > buf.c &&
./configure --prefix=/usr &&
make &&
make install &&
mv /usr/bin/ed /usr/bin/red /bin

Command explanations

The sed commands fix a symlink vulnerability in ed. The ed executable creates files in /tmp with predictable names. By using various symlink attacks, it is possible to have ed write to files it should not, change the permissions of various files, etc.

Contents of ed-0.2

Program Files

ed and red (link to ed)

Description

ed

Ed is a line-oriented text editor. It is used to create, display, modify and otherwise manipulate text files.

red

red is a restricted ed: it can only edit files in the current directory and cannot execute shell commands.

Dependencies

Ed-0.2 needs the following to be installed:


bash: sh
binutils: ar, as, ld
fileutils: chmod, cp, ln, mv, rm, touch
gcc: cc
grep: grep, egrep
make: make
sed: sed
textutils: cat, tr