aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2003-12-24 20:44:41 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2003-12-24 20:44:41 +0000
commit380e61ac3cb60542880d336b49b22597d0ac119b (patch)
tree5c0c3c7822277bba936e8639726c4523e0ef2589
parent707d96d94ce1ff9f2ec3992135d96fe5a8a570aa (diff)
downloadports-380e61ac3cb60542880d336b49b22597d0ac119b.tar.gz
ports-380e61ac3cb60542880d336b49b22597d0ac119b.zip
* Fix the intended functionality of the previous commit (i.e. /dev/<dev>c,
/dev/<dev>, and <dev> are all searched) * Fix a potential buffer overflow introduced by the previous commit * Fix a memory leak introduced in the previous commit * Fix the case where <dev> is not a symlink * Reset maintainer to ports@ Approved by: shige (previous maintainer)
Notes
Notes: svn path=/head/; revision=96548
-rw-r--r--sysutils/eject/Makefile4
-rw-r--r--sysutils/eject/files/patch-aa23
2 files changed, 14 insertions, 13 deletions
diff --git a/sysutils/eject/Makefile b/sysutils/eject/Makefile
index 2cdc52b7e065..ebe4214ede84 100644
--- a/sysutils/eject/Makefile
+++ b/sysutils/eject/Makefile
@@ -7,13 +7,13 @@
PORTNAME= eject
PORTVERSION= 1.4
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= ftp://ports.jp.FreeBSD.org/pub/FreeBSD-jp/OD/ \
ftp://ftp4.jp.FreeBSD.org/pub/FreeBSD-jp/OD/ \
ftp://ftp.ics.es.osaka-u.ac.jp/pub/mirrors/FreeBSD-jp/OD/
-MAINTAINER= shige@FreeBSD.org
+MAINTAINER= ports@FreeBSD.org
COMMENT= Utility for ejecting media from CD or optical disk drive
DOCDIR= share/doc/eject
diff --git a/sysutils/eject/files/patch-aa b/sysutils/eject/files/patch-aa
index a80b8055837b..c6766dfdeab1 100644
--- a/sysutils/eject/files/patch-aa
+++ b/sysutils/eject/files/patch-aa
@@ -1,5 +1,5 @@
---- eject.c.orig Tue Jan 4 06:42:12 2000
-+++ eject.c Mon Sep 29 07:16:58 2003
+--- eject.c.orig Tue Jan 4 09:42:12 2000
++++ eject.c Wed Dec 24 01:11:34 2003
@@ -43,8 +43,8 @@
extern int optind;
@@ -22,7 +22,7 @@
char *defdev;
fflag = nflag = vflag = 0;
-@@ -95,18 +95,27 @@
+@@ -95,18 +95,28 @@
if (argc == 0) {
usage();
}
@@ -41,8 +41,9 @@
+ } else {
+ int c;
+ char *dev_bak = malloc(MAXPATHLEN);
-+ if (c = readlink(device, dev_bak, MAXPATHLEN)) {
++ if ((c = readlink(device, dev_bak, MAXPATHLEN-1)) != -1) {
+ dev_bak[c] = '\0';
++ free(name);
+ name = dev_bak;
+ } else {
+ free(dev_bak);
@@ -54,7 +55,7 @@
if (sts < 0) {
perror(err);
exit(1);
-@@ -128,16 +137,26 @@
+@@ -128,16 +138,26 @@
int
check_device(name, device)
char *name;
@@ -62,15 +63,15 @@
+ char **device;
{
- int sts;
-+ int sts, i;
++ int sts = 0, i;
struct stat sb;
- sprintf(device, "/dev/r%sc", name);
- if (vflag || nflag) {
- printf("%s: using device %s\n", program, device);
-+ const char* dev_list[] = { "/dev/%sc", "/dev/%s", "%s" };
-+ for (i = 0; i < 2; i++) {
-+ if (asprintf(device, dev_list[i], name) == -1)
++ const char* dev_list[] = { "/dev/%sc", "/dev/%s", "%s", NULL };
++ for (i = 0; dev_list[i]; i++) {
++ if ((sts = asprintf(device, dev_list[i], name)) == -1)
+ return sts;
+ if (vflag || nflag) {
+ printf("%s: trying device %s\n", program, *device);
@@ -87,7 +88,7 @@
return sts;
}
-@@ -155,7 +174,7 @@
+@@ -155,7 +175,7 @@
int
unmount_fs(name, err)
char *name;
@@ -96,7 +97,7 @@
{
int mnts;
struct statfs *mntbuf;
-@@ -221,7 +240,7 @@
+@@ -221,7 +241,7 @@
sts = 0;
}
if (sts < 0 && fflag == 0) {