summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/unarj')
-rw-r--r--app-arch/unarj/Manifest1
-rw-r--r--app-arch/unarj/files/unarj-2.65-CAN-2004-0947.patch49
-rw-r--r--app-arch/unarj/files/unarj-2.65-gentoo-fbsd.patch9
-rw-r--r--app-arch/unarj/files/unarj-2.65-sanitation.patch126
-rw-r--r--app-arch/unarj/metadata.xml10
-rw-r--r--app-arch/unarj/unarj-2.65.ebuild33
6 files changed, 228 insertions, 0 deletions
diff --git a/app-arch/unarj/Manifest b/app-arch/unarj/Manifest
new file mode 100644
index 000000000000..7149bd6ccb3c
--- /dev/null
+++ b/app-arch/unarj/Manifest
@@ -0,0 +1 @@
+DIST unarj-2.65.tgz 21568 SHA256 092869f3b4d4943b3d999db4f266f39ab9e474f2984b813b20735283af068304 SHA512 1b152063017042a343f49e487e5284c3d4c548222baa52e2066cefe6d2add60213ffd2653f42e38582681a1fd89efb8f1d3a6ef6389fc33e5397760ad9e72386 WHIRLPOOL 431d8b43d58f05bf0a9213e98c5c15e3ae4b32089426d2b89b2832b0249390d8491293c0ed0f97e6c3c44f30056e497ce0f1ad807302f0d36c738e4a6085374a
diff --git a/app-arch/unarj/files/unarj-2.65-CAN-2004-0947.patch b/app-arch/unarj/files/unarj-2.65-CAN-2004-0947.patch
new file mode 100644
index 000000000000..f52af83ac2ca
--- /dev/null
+++ b/app-arch/unarj/files/unarj-2.65-CAN-2004-0947.patch
@@ -0,0 +1,49 @@
+Index: unarj-2.65/unarj.c
+===================================================================
+--- unarj-2.65.orig/unarj.c
++++ unarj-2.65/unarj.c
+@@ -217,7 +217,7 @@ static uchar arj_flags;
+ static short method;
+ static uint file_mode;
+ static ulong time_stamp;
+-static short entry_pos;
++static ushort entry_pos;
+ static ushort host_data;
+ static uchar *get_ptr;
+ static UCRC file_crc;
+@@ -608,6 +608,7 @@ char *name;
+ error(M_BADHEADR, "");
+
+ crc = CRC_MASK;
++ memset(header, 0, sizeof(header));
+ fread_crc(header, (int) headersize, fd);
+ header_crc = fget_crc(fd);
+ if ((crc ^ CRC_MASK) != header_crc)
+@@ -632,9 +633,13 @@ char *name;
+
+ if (origsize < 0 || compsize < 0)
+ error(M_HEADRCRC, "");
++ if(first_hdr_size > headersize-2) /* need two \0 for file and comment */
++ error(M_BADHEADR, "");
+
+ hdr_filename = (char *)&header[first_hdr_size];
+ strncopy(filename, hdr_filename, sizeof(filename));
++ if(entry_pos >= strlen(filename))
++ error(M_BADHEADR, "");
+ if (host_os != OS)
+ strparity((uchar *)filename);
+ if ((arj_flags & PATHSYM_FLAG) != 0)
+@@ -733,11 +738,11 @@ extract()
+
+ no_output = 0;
+ if (command == 'E')
+- strcpy(name, &filename[entry_pos]);
++ strncopy(name, &filename[entry_pos], sizeof(name));
+ else
+ {
+ strcpy(name, DEFAULT_DIR);
+- strcat(name, filename);
++ strncopy(name+strlen(name), filename, sizeof(name)-strlen(name));
+ }
+
+ if (host_os != OS)
diff --git a/app-arch/unarj/files/unarj-2.65-gentoo-fbsd.patch b/app-arch/unarj/files/unarj-2.65-gentoo-fbsd.patch
new file mode 100644
index 000000000000..755b9b696cc9
--- /dev/null
+++ b/app-arch/unarj/files/unarj-2.65-gentoo-fbsd.patch
@@ -0,0 +1,9 @@
+--- environ.c 2007-06-19 12:44:09 +0200
++++ environ.c.new 2007-06-19 12:44:37 +0200
+@@ -437,7 +437,6 @@
+ #endif
+
+ extern struct tm *localtime();
+-extern time_t time();
+ extern char *strcpy();
+ extern voidp *malloc(); \ No newline at end of file
diff --git a/app-arch/unarj/files/unarj-2.65-sanitation.patch b/app-arch/unarj/files/unarj-2.65-sanitation.patch
new file mode 100644
index 000000000000..f37784ed2491
--- /dev/null
+++ b/app-arch/unarj/files/unarj-2.65-sanitation.patch
@@ -0,0 +1,126 @@
+Index: unarj-2.65/sanitize.c
+===================================================================
+--- /dev/null
++++ unarj-2.65/sanitize.c
+@@ -0,0 +1,81 @@
++/*
++ * Path sanitation code by Ludwig Nussel <ludwig.nussel@suse.de>. Public Domain.
++ */
++
++#include "unarj.h"
++
++#include <string.h>
++#include <limits.h>
++#include <stdio.h>
++
++#ifndef PATH_CHAR
++#define PATH_CHAR '/'
++#endif
++#ifndef MIN
++#define MIN(x,y) ((x)<(y)?(x):(y))
++#endif
++
++/* copy src into dest converting the path to a relative one inside the current
++ * directory. dest must hold at least len bytes */
++void copy_path_relative(char *dest, char *src, size_t len)
++{
++ char* o = dest;
++ char* p = src;
++
++ *o = '\0';
++
++ while(*p && *p == PATH_CHAR) ++p;
++ for(; len && *p;)
++ {
++ src = p;
++ p = strchr(src, PATH_CHAR);
++ if(!p) p = src+strlen(src);
++
++ /* . => skip */
++ if(p-src == 1 && *src == '.' )
++ {
++ if(*p) src = ++p;
++ }
++ /* .. => pop one */
++ else if(p-src == 2 && *src == '.' && src[1] == '.')
++ {
++ if(o != dest)
++ {
++ char* tmp;
++ *o = '\0';
++ tmp = strrchr(dest, PATH_CHAR);
++ if(!tmp)
++ {
++ len += o-dest;
++ o = dest;
++ if(*p) ++p;
++ }
++ else
++ {
++ len += o-tmp;
++ o = tmp;
++ if(*p) ++p;
++ }
++ }
++ else /* nothing to pop */
++ if(*p) ++p;
++ }
++ else
++ {
++ size_t copy;
++ if(o != dest)
++ {
++ --len;
++ *o++ = PATH_CHAR;
++ }
++ copy = MIN(p-src,len);
++ memcpy(o, src, copy);
++ len -= copy;
++ src += copy;
++ o += copy;
++ if(*p) ++p;
++ }
++ while(*p && *p == PATH_CHAR) ++p;
++ }
++ o[len?0:-1] = '\0';
++}
+Index: unarj-2.65/unarj.c
+===================================================================
+--- unarj-2.65.orig/unarj.c
++++ unarj-2.65/unarj.c
+@@ -235,6 +235,8 @@ static UCRC crctable[UCHAR_MAX + 1];
+
+ /* Functions */
+
++void copy_path_relative(char *dest, char *src, size_t len);
++
+ static void
+ make_crctable()
+ {
+@@ -738,11 +740,11 @@ extract()
+
+ no_output = 0;
+ if (command == 'E')
+- strncopy(name, &filename[entry_pos], sizeof(name));
++ copy_path_relative(name, &filename[entry_pos], sizeof(name));
+ else
+ {
+ strcpy(name, DEFAULT_DIR);
+- strncopy(name+strlen(name), filename, sizeof(name)-strlen(name));
++ copy_path_relative(name+strlen(name), filename, sizeof(name)-strlen(name));
+ }
+
+ if (host_os != OS)
+--- unarj-2.65.orig/Makefile Mon Nov 29 16:47:24 2004
++++ unarj-2.65/Makefile Mon Nov 29 22:46:56 2004
+@@ -9,7 +9,9 @@
+
+ decode.o: decode.c unarj.h
+
+-OBJS = unarj.o decode.o environ.o
++sanitize.o: sanitize.c unarj.h
++
++OBJS = unarj.o decode.o environ.o sanitize.o
+
+ unarj: $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) -o unarj
diff --git a/app-arch/unarj/metadata.xml b/app-arch/unarj/metadata.xml
new file mode 100644
index 000000000000..d4771b00896e
--- /dev/null
+++ b/app-arch/unarj/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>proxy-maintainers</herd>
+<maintainer>
+ <email>nitro@legroom.net</email>
+ <name>Jared B.</name>
+</maintainer>
+<longdescription>A utility that is designed to open arj archives.</longdescription>
+</pkgmetadata>
diff --git a/app-arch/unarj/unarj-2.65.ebuild b/app-arch/unarj/unarj-2.65.ebuild
new file mode 100644
index 000000000000..ac6215deac3b
--- /dev/null
+++ b/app-arch/unarj/unarj-2.65.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Utility for opening arj archives"
+HOMEPAGE="http://www.arjsoftware.com/"
+SRC_URI="mirror://freebsd/ports/local-distfiles/ache/${P}.tgz"
+
+LICENSE="arj"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
+IUSE=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${P}-CAN-2004-0947.patch
+ epatch "${FILESDIR}"/${P}-sanitation.patch
+ epatch "${FILESDIR}"/${P}-gentoo-fbsd.patch
+}
+
+src_compile() {
+ tc-export CC
+ emake || die
+}
+
+src_install() {
+ dobin unarj || die 'dobin failed'
+ dodoc unarj.txt technote.txt || die 'dodoc failed'
+}