Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Feb 2016 22:46:58 +0000 (UTC)
From:      Alex Kozlov <ak@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r408602 - in head/archivers/unarj: . files
Message-ID:  <201602092246.u19MkwVr093929@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ak
Date: Tue Feb  9 22:46:58 2016
New Revision: 408602
URL: https://svnweb.freebsd.org/changeset/ports/408602

Log:
  - Update port description
  - Tidy up patches

Added:
  head/archivers/unarj/files/patch-CVE-2004-0947
     - copied, changed from r408601, head/archivers/unarj/files/patch-00-over-unarj.c
  head/archivers/unarj/files/patch-CVE-2004-1027
     - copied, changed from r408601, head/archivers/unarj/files/patch-01-path-unarj.c
  head/archivers/unarj/files/patch-environ.c
     - copied unchanged from r408601, head/archivers/unarj/files/patch-ac
  head/archivers/unarj/files/patch-unarj.c
     - copied unchanged from r408601, head/archivers/unarj/files/patch-ab
  head/archivers/unarj/files/patch-unarj.h
     - copied unchanged from r408601, head/archivers/unarj/files/patch-aa
Deleted:
  head/archivers/unarj/files/patch-00-over-unarj.c
  head/archivers/unarj/files/patch-01-path-Makefile
  head/archivers/unarj/files/patch-01-path-unarj.c
  head/archivers/unarj/files/patch-aa
  head/archivers/unarj/files/patch-ab
  head/archivers/unarj/files/patch-ac
  head/archivers/unarj/files/sanitize.c
Modified:
  head/archivers/unarj/Makefile
  head/archivers/unarj/pkg-descr

Modified: head/archivers/unarj/Makefile
==============================================================================
--- head/archivers/unarj/Makefile	Tue Feb  9 22:27:53 2016	(r408601)
+++ head/archivers/unarj/Makefile	Tue Feb  9 22:46:58 2016	(r408602)
@@ -17,9 +17,6 @@ PORTDOCS=	unarj.txt technote.txt
 
 OPTIONS_DEFINE=	DOCS
 
-post-patch:
-	${CP} ${FILESDIR}/sanitize.c ${WRKSRC}
-
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/unarj ${STAGEDIR}${PREFIX}/bin
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}

Copied and modified: head/archivers/unarj/files/patch-CVE-2004-0947 (from r408601, head/archivers/unarj/files/patch-00-over-unarj.c)
==============================================================================
--- head/archivers/unarj/files/patch-00-over-unarj.c	Tue Feb  9 22:27:53 2016	(r408601, copy source)
+++ head/archivers/unarj/files/patch-CVE-2004-0947	Tue Feb  9 22:46:58 2016	(r408602)
@@ -1,5 +1,5 @@
---- unarj-2.65.orig/unarj.c
-+++ unarj.c
+- Fix buffer overflow problem in filename handling (CAN-2004-0947)
+Index: unarj.c
 @@ -217,7 +217,7 @@ static uchar  arj_flags;
  static short  method;
  static uint   file_mode;

Copied and modified: head/archivers/unarj/files/patch-CVE-2004-1027 (from r408601, head/archivers/unarj/files/patch-01-path-unarj.c)
==============================================================================
--- head/archivers/unarj/files/patch-01-path-unarj.c	Tue Feb  9 22:27:53 2016	(r408601, copy source)
+++ head/archivers/unarj/files/patch-CVE-2004-1027	Tue Feb  9 22:46:58 2016	(r408602)
@@ -1,5 +1,5 @@
---- unarj-2.65.orig/unarj.c
-+++ unarj.c
+- Fix unchecked path extraction problem (CAN-2004-1027)
+Index: unarj.c
 @@ -235,6 +235,8 @@ static UCRC   crctable[UCHAR_MAX + 1];
  
  /* Functions */
@@ -23,3 +23,98 @@
      }
  
      if (host_os != OS)
+Index: Makefile
+@@ -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
+Index: 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';
++}

Copied: head/archivers/unarj/files/patch-environ.c (from r408601, head/archivers/unarj/files/patch-ac)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/archivers/unarj/files/patch-environ.c	Tue Feb  9 22:46:58 2016	(r408602, copy of r408601, head/archivers/unarj/files/patch-ac)
@@ -0,0 +1,83 @@
+--- environ.c.orig	Mon Sep 29 14:00:24 1997
++++ environ.c	Thu Feb 18 01:14:35 1999
+@@ -430,16 +430,24 @@
+ 
+ #define SUBS_DEFINED
+ 
++#include <stdlib.h>
++#include <string.h>
+ #include <time.h>
++#include <sys/types.h>
++#include <utime.h>
+ 
+-#ifndef time_t
+-#define time_t long
+-#endif
++/*#ifndef time_t
++ #define time_t long
++ #endif*/
++
++#include <sys/param.h>
+ 
++#if !(defined(BSD) && BSD >= 199306)
+ extern struct tm *localtime();
+ extern time_t time();
+ extern char   *strcpy();
+ extern voidp  *malloc();
++#endif
+ 
+ FILE *
+ file_open(name, mode)
+@@ -535,8 +543,12 @@
+ }
+ 
+ long
+-gettz()         /* returns the offset from GMT in seconds */
++gettz(stamp)         /* returns the offset from GMT in seconds */
++time_t stamp;
+ {
++#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
++	return -localtime(&stamp)->tm_gmtoff;
++#else
+ #define NOONOFFSET    43200L
+ #define SEC_IN_DAY    (24L * 60L * 60L)
+ #define INV_VALUE     (SEC_IN_DAY + 1L)
+@@ -552,6 +564,7 @@
+     noontm = localtime(&noon);
+     retval = NOONOFFSET - 60 * (60 * noontm->tm_hour - noontm->tm_min);
+     return retval;
++#endif
+ }
+ 
+ long
+@@ -600,19 +613,29 @@
+ {
+     time_t m_time;
+     struct utimbuf
++#ifndef __FreeBSD__
+     {
+        time_t atime;             /* New access time */
+        time_t mtime;             /* New modification time */
+     } tb;
++#else
++    tb;
++#endif
+ 
+     (char *) name;
+     (uint) attribute;
+     (uint) host;
+ 
+-    m_time = mstonix(tstamp) + gettz();
++    m_time = mstonix(tstamp);
++    m_time += gettz(m_time);
+ 
++#ifndef __FreeBSD__
+     tb.mtime = m_time;                  /* Set modification time */
+     tb.atime = m_time;                  /* Set access time */
++#else
++    tb.modtime = m_time;                /* Set modification time */
++    tb.actime = m_time;                 /* Set access time */
++#endif
+ 
+     /* set the time stamp on the file */
+     return utime(name, &tb);

Copied: head/archivers/unarj/files/patch-unarj.c (from r408601, head/archivers/unarj/files/patch-ab)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/archivers/unarj/files/patch-unarj.c	Tue Feb  9 22:46:58 2016	(r408602, copy of r408601, head/archivers/unarj/files/patch-ab)
@@ -0,0 +1,44 @@
+--- unarj.c.orig	Wed Jun  5 12:28:06 2002
++++ unarj.c	Mon Nov 29 17:48:27 2004
+@@ -54,6 +54,10 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <ctype.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <fcntl.h>
++#include <unistd.h>
+ #else /* !MODERN */
+ extern void free();
+ extern void exit();
+@@ -718,6 +722,8 @@
+ extract()
+ {
+     char name[FNAME_MAX];
++    char dir[FNAME_MAX];
++    char *pos;
+ 
+     if (check_flags())
+     {
+@@ -736,6 +742,21 @@
+ 
+     if (host_os != OS)
+         default_case_path(name);
++
++
++    /*
++       8/8/2000 Phil Knirsch: Bugfix to create subdirectories. Unarj didn't
++       do this for a long time, so it's finally fixed.
++    */
++    pos = strchr(name, PATH_CHAR);
++
++    while (pos != NULL)
++    {
++        strncpy(dir, name, pos-name);
++        dir[pos-name] = '\0';
++        mkdir(dir, 0777);
++        pos = strchr(pos+1, PATH_CHAR);
++    }
+ 
+     if (file_exists(name))
+     {

Copied: head/archivers/unarj/files/patch-unarj.h (from r408601, head/archivers/unarj/files/patch-aa)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/archivers/unarj/files/patch-unarj.h	Tue Feb  9 22:46:58 2016	(r408602, copy of r408601, head/archivers/unarj/files/patch-aa)
@@ -0,0 +1,15 @@
+--- unarj.h.orig	Mon Sep 29 14:00:24 1997
++++ unarj.h	Thu Feb 18 01:06:10 1999
+@@ -106,8 +106,12 @@
+ #endif
+ 
+ typedef unsigned char  uchar;   /*  8 bits or more */
++#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+ typedef unsigned int   uint;    /* 16 - 32 bits or more */
+ typedef unsigned short ushort;  /* 16 bits or more */
++#else
++#  include <sys/types.h>
++#endif
+ typedef unsigned long  ulong;   /* 32 bits or more */
+ 
+ #define USHRT_BIT   (CHAR_BIT * sizeof(ushort))

Modified: head/archivers/unarj/pkg-descr
==============================================================================
--- head/archivers/unarj/pkg-descr	Tue Feb  9 22:27:53 2016	(r408601)
+++ head/archivers/unarj/pkg-descr	Tue Feb  9 22:46:58 2016	(r408602)
@@ -1,7 +1,5 @@
-This is an extract-only program which allows access to the contents of ARJ 
-archives. You cannot specify a base directory or select individual files 
-to extract.  UNARJ does not support empty directories or volume labels.  
-UNARJ is much slower than ARJ because ARJ is highly optimized using 
-assembly language.
+This is an extract-only program which allows access to the contents of ARJ
+archives. You cannot specify a base directory or select individual files
+to extract.  UNARJ does not support empty directories or volume labels.
 
 WWW: http://www.arjsoftware.com/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602092246.u19MkwVr093929>