Yet another overflow check, better temp file name & misc cleanups
Submitted by: kris & Debian (edited by me)
This commit is contained in:
parent
4c0771ee11
commit
b2ba8b886d
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=82972
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= mpack
|
||||
PORTVERSION= 1.5
|
||||
PORTREVISION= 2
|
||||
PORTREVISION= 3
|
||||
CATEGORIES= converters mail news
|
||||
MASTER_SITES= ftp://ftp.andrew.cmu.edu/pub/mpack/
|
||||
DISTNAME= ${PORTNAME}-${PORTVERSION}-src
|
||||
|
@ -1,55 +1,43 @@
|
||||
*** Makefile.orig Thu Feb 16 15:39:41 1995
|
||||
--- Makefile Sat May 15 19:18:04 1999
|
||||
***************
|
||||
*** 1,5 ****
|
||||
! CFLAGS=$(OPT) $(DEFINES)
|
||||
! OPT=-O
|
||||
|
||||
|
||||
#Uncomment the following line if your system does not have strchr()
|
||||
--- 1,5 ----
|
||||
! CFLAGS+=$(OPT) $(DEFINES)
|
||||
! #OPT=-O
|
||||
|
||||
|
||||
#Uncomment the following line if your system does not have strchr()
|
||||
***************
|
||||
*** 28,34 ****
|
||||
UNPACKOBJS = unixunpk.o decode.o uudecode.o codes.o unixos.o string.o \
|
||||
part.o xmalloc.o md5c.o getopt.o
|
||||
|
||||
! DESTDIR=/usr/local
|
||||
|
||||
all: mpack munpack
|
||||
|
||||
--- 28,34 ----
|
||||
UNPACKOBJS = unixunpk.o decode.o uudecode.o codes.o unixos.o string.o \
|
||||
part.o xmalloc.o md5c.o getopt.o
|
||||
|
||||
! DESTDIR?=/usr/local
|
||||
|
||||
all: mpack munpack
|
||||
|
||||
***************
|
||||
*** 42,51 ****
|
||||
-mkdir $(DESTDIR)/bin
|
||||
-mkdir $(DESTDIR)/man
|
||||
-mkdir $(DESTDIR)/man/man1
|
||||
! install -s -m 755 mpack $(DESTDIR)/bin
|
||||
! install -s -m 755 munpack $(DESTDIR)/bin
|
||||
! install -m 644 unixpk.man $(DESTDIR)/man/man1/mpack.1
|
||||
! install -m 644 unixunpk.man $(DESTDIR)/man/man1/munpack.1
|
||||
|
||||
clean:
|
||||
rm -f *.o mpack munpack
|
||||
--- 42,51 ----
|
||||
-mkdir $(DESTDIR)/bin
|
||||
-mkdir $(DESTDIR)/man
|
||||
-mkdir $(DESTDIR)/man/man1
|
||||
! install -c -s -m 755 mpack $(DESTDIR)/bin
|
||||
! install -c -s -m 755 munpack $(DESTDIR)/bin
|
||||
! install -c -m 644 unixpk.man $(DESTDIR)/man/man1/mpack.1
|
||||
! install -c -m 644 unixunpk.man $(DESTDIR)/man/man1/munpack.1
|
||||
|
||||
clean:
|
||||
rm -f *.o mpack munpack
|
||||
--- Makefile.orig Thu Feb 16 13:39:41 1995
|
||||
+++ Makefile Fri Jun 13 14:45:29 2003
|
||||
@@ -1,5 +1,5 @@
|
||||
-CFLAGS=$(OPT) $(DEFINES)
|
||||
-OPT=-O
|
||||
+#CFLAGS=$(OPT) $(DEFINES)
|
||||
+#OPT=-O
|
||||
|
||||
|
||||
#Uncomment the following line if your system does not have strchr()
|
||||
@@ -22,13 +22,14 @@
|
||||
#Uncomment the following lines on SVR4
|
||||
#LIBS=-lsocket -lnsl
|
||||
|
||||
+LIBS=-lmd
|
||||
|
||||
PACKOBJS = unixpk.o encode.o codes.o magic.o unixos.o string.o \
|
||||
- xmalloc.o md5c.o getopt.o
|
||||
+ xmalloc.o
|
||||
UNPACKOBJS = unixunpk.o decode.o uudecode.o codes.o unixos.o string.o \
|
||||
- part.o xmalloc.o md5c.o getopt.o
|
||||
+ part.o xmalloc.o
|
||||
|
||||
-DESTDIR=/usr/local
|
||||
+DESTDIR?=/usr/local
|
||||
|
||||
all: mpack munpack
|
||||
|
||||
@@ -42,10 +43,10 @@
|
||||
-mkdir $(DESTDIR)/bin
|
||||
-mkdir $(DESTDIR)/man
|
||||
-mkdir $(DESTDIR)/man/man1
|
||||
- install -s -m 755 mpack $(DESTDIR)/bin
|
||||
- install -s -m 755 munpack $(DESTDIR)/bin
|
||||
- install -m 644 unixpk.man $(DESTDIR)/man/man1/mpack.1
|
||||
- install -m 644 unixunpk.man $(DESTDIR)/man/man1/munpack.1
|
||||
+ install -c -s -m 755 mpack $(DESTDIR)/bin
|
||||
+ install -c -s -m 755 munpack $(DESTDIR)/bin
|
||||
+ install -c -m 644 unixpk.man $(DESTDIR)/man/man1/mpack.1
|
||||
+ install -c -m 644 unixunpk.man $(DESTDIR)/man/man1/munpack.1
|
||||
|
||||
clean:
|
||||
rm -f *.o mpack munpack
|
||||
|
@ -1,35 +0,0 @@
|
||||
diff -ruN mpack-1.5/decode.c mpack/decode.c
|
||||
--- decode.c Fri Feb 17 08:39:44 1995
|
||||
+++ decode.c Thu Nov 1 10:40:23 2001
|
||||
@@ -467,6 +467,7 @@
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
+ left = VALUEGROWSIZE;
|
||||
to = value + alloced - left - 2;
|
||||
}
|
||||
if (*from == '\\') {
|
||||
@@ -483,6 +484,7 @@
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
+ left = VALUEGROWSIZE;
|
||||
to = value + alloced - left - 2;
|
||||
}
|
||||
*to++ = *from++;
|
||||
@@ -572,6 +574,7 @@
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
+ left = VALUEGROWSIZE;
|
||||
to = value + alloced - left - 2;
|
||||
}
|
||||
if (*disposition == '\\') {
|
||||
@@ -589,6 +592,7 @@
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
+ left = VALUEGROWSIZE;
|
||||
to = value + alloced - left - 2;
|
||||
}
|
||||
*to++ = *disposition++;
|
@ -1,46 +0,0 @@
|
||||
--- unixos.c.orig Fri Feb 17 00:39:50 1995
|
||||
+++ unixos.c Wed Aug 28 19:56:07 2002
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
/* Create and return directory for a message-id */
|
||||
char *os_idtodir(id)
|
||||
-char *id;
|
||||
+unsigned char *id;
|
||||
{
|
||||
static char buf[4096];
|
||||
char *p;
|
||||
@@ -89,7 +89,11 @@
|
||||
strcpy(buf, getenv("TMPDIR"));
|
||||
}
|
||||
else {
|
||||
+#ifdef __FreeBSD__
|
||||
+ strcpy(buf, "/var/tmp");
|
||||
+#else
|
||||
strcpy(buf, "/usr/tmp");
|
||||
+#endif
|
||||
}
|
||||
strcat(buf, "/m-prts-");
|
||||
p = getenv("USER");
|
||||
@@ -144,7 +148,7 @@
|
||||
int flags;
|
||||
params contentParams;
|
||||
{
|
||||
- char *p;
|
||||
+ unsigned char *p;
|
||||
static int filesuffix=0;
|
||||
char buf[128], *descfname=0;
|
||||
FILE *outfile = 0;
|
||||
@@ -160,6 +164,13 @@
|
||||
/* Get rid of leading ~ or ~/ */
|
||||
while (*fname == '~' || *fname == '/') fname++;
|
||||
|
||||
+ for (p=fname; *p; p += 3) {
|
||||
+ if (!strncmp(p, "../", 3)) {
|
||||
+ p[0] = p[1] = 'X';
|
||||
+ } else
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/* Clean out bad characters, create directories along path */
|
||||
for (p=fname; *p; p++) {
|
||||
if (*p == '/') {
|
14
converters/mpack/files/patch-codes_c
Normal file
14
converters/mpack/files/patch-codes_c
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-codes_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
|
||||
--- codes.c.orig Fri Aug 9 02:55:28 2002
|
||||
+++ codes.c Fri Aug 9 02:56:20 2002
|
||||
@@ -38,8 +38,9 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <md5.h>
|
||||
#include "xmalloc.h"
|
||||
-#include "md5.h"
|
||||
|
||||
static char basis_64[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
64
converters/mpack/files/patch-decode_c
Normal file
64
converters/mpack/files/patch-decode_c
Normal file
@ -0,0 +1,64 @@
|
||||
$OpenBSD: patch-decode_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
|
||||
--- decode.c.orig Thu Feb 16 22:39:44 1995
|
||||
+++ decode.c Fri Aug 9 03:03:32 2002
|
||||
@@ -28,10 +28,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <md5.h>
|
||||
#include "xmalloc.h"
|
||||
#include "common.h"
|
||||
#include "part.h"
|
||||
-#include "md5.h"
|
||||
|
||||
extern char *os_idtodir();
|
||||
extern FILE *os_newtypedfile();
|
||||
@@ -416,6 +416,15 @@ char **headerp;
|
||||
}
|
||||
if (*header) *header++ = '\0';
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * Debian fix: if there was only an empty parameter list (a bare
|
||||
+ * semicolon) then there is no guarantee that param[nparam] exists.
|
||||
+ * Therefore, treat it as if there is no parameter list.
|
||||
+ */
|
||||
+ if (nparam == 0)
|
||||
+ return 0;
|
||||
+
|
||||
param[nparam] = 0;
|
||||
return param;
|
||||
}
|
||||
@@ -466,6 +475,7 @@ char *key;
|
||||
while (*from && *from != '\"') {
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
+ left += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
to = value + alloced - left - 2;
|
||||
}
|
||||
@@ -482,6 +492,7 @@ char *key;
|
||||
while (*from && !isspace(*from)) {
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
+ left += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
to = value + alloced - left - 2;
|
||||
}
|
||||
@@ -571,6 +582,7 @@ char *disposition;
|
||||
while (*disposition && *disposition != '\"') {
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
+ left += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
to = value + alloced - left - 2;
|
||||
}
|
||||
@@ -588,6 +600,7 @@ char *disposition;
|
||||
*disposition != '(') {
|
||||
if (!--left) {
|
||||
alloced += VALUEGROWSIZE;
|
||||
+ left += VALUEGROWSIZE;
|
||||
value = xrealloc(value, alloced);
|
||||
to = value + alloced - left - 2;
|
||||
}
|
11
converters/mpack/files/patch-magic_c
Normal file
11
converters/mpack/files/patch-magic_c
Normal file
@ -0,0 +1,11 @@
|
||||
$OpenBSD: patch-magic_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
|
||||
--- magic.c.orig Fri Aug 9 02:36:58 2002
|
||||
+++ magic.c Fri Aug 9 02:37:21 2002
|
||||
@@ -23,6 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <string.h>
|
||||
|
||||
/* Description of the various file formats and their magic numbers */
|
||||
struct magic {
|
12
converters/mpack/files/patch-unixpk_c
Normal file
12
converters/mpack/files/patch-unixpk_c
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-unixpk_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
|
||||
--- unixpk.c.orig Thu Feb 16 22:39:50 1995
|
||||
+++ unixpk.c Mon Aug 5 12:30:30 2002
|
||||
@@ -165,7 +165,7 @@ char **argv;
|
||||
strcpy(fnamebuf, "/tmp");
|
||||
}
|
||||
strcat(fnamebuf, "/mpackXXXXXX");
|
||||
- mktemp(fnamebuf);
|
||||
+ close(mkstemp(fnamebuf));
|
||||
outfname = strsave(fnamebuf);
|
||||
}
|
||||
|
12
converters/mpack/files/patch-unixunpk_c
Normal file
12
converters/mpack/files/patch-unixunpk_c
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-unixunpk_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
|
||||
--- unixunpk.c.orig Fri Aug 9 02:44:18 2002
|
||||
+++ unixunpk.c Fri Aug 9 02:44:38 2002
|
||||
@@ -100,7 +100,7 @@ char **argv;
|
||||
|
||||
usage() {
|
||||
fprintf(stderr, "munpack version %s\n", MPACK_VERSION);
|
||||
- fprintf(stderr, "usage: munpack [-f] [-q] [-C directory] [files...]\n");
|
||||
+ fprintf(stderr, "usage: munpack [-f] [-q] [-t] [-C directory] [files...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user