summaryrefslogtreecommitdiffstats
path: root/sysutils/eject
diff options
context:
space:
mode:
authormarcus <marcus@FreeBSD.org>2003-12-24 20:44:41 +0000
committermarcus <marcus@FreeBSD.org>2003-12-24 20:44:41 +0000
commitdca36339e3fbb1b62e373c10ce89a4c18b242435 (patch)
treeb5271d9395eb9a8cf53dced98ec4b5cc2f84ecff /sysutils/eject
parentde73bec6bcb6f7d8fccffb5edc8b902f9c61a0b7 (diff)
downloadFreeBSD-ports-dca36339e3fbb1b62e373c10ce89a4c18b242435.zip
FreeBSD-ports-dca36339e3fbb1b62e373c10ce89a4c18b242435.tar.gz
* 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)
Diffstat (limited to 'sysutils/eject')
-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 2cdc52b..ebe4214 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 a80b805..c6766df 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) {
OpenPOWER on IntegriCloud