Update to libtar-1.2.20, new upstream.

Tweaked diff from Rafael Sadowski.
This commit is contained in:
jca 2016-11-05 15:13:54 +00:00
parent d53906f57f
commit 6ea856432c
5 changed files with 20 additions and 172 deletions

View File

@ -1,26 +1,34 @@
# $OpenBSD: Makefile,v 1.13 2015/11/24 09:11:02 jasper Exp $
# $OpenBSD: Makefile,v 1.14 2016/11/05 15:13:54 jca Exp $
COMMENT= C library for manipulating tar files
DISTNAME= libtar-1.2.11
REVISION= 2
GH_ACCOUNT= tklauser
GH_PROJECT= libtar
GH_TAGNAME= v1.2.20
SHARED_LIBS= tar 0.0 # .1.2
SHARED_LIBS= tar 0.1 # unknown
CATEGORIES= archivers devel
HOMEPAGE= http://www.feep.net/libtar/
# BSD-like
PERMIT_PACKAGE_CDROM= Yes
WANTLIB= c z
MASTER_SITES= https://distfiles.nl/ \
ftp://ftp.feep.net/pub/software/libtar/
BUILD_DEPENDS= ${MODGNU_AUTOCONF_DEPENDS} \
${MODGNU_AUTOMAKE_DEPENDS} \
devel/libtool
NO_TEST= Yes
USE_GMAKE= Yes
CONFIGURE_STYLE= gnu
CONFIGURE_STYLE=gnu
AUTOCONF_VERSION= 2.69
AUTOMAKE_VERSION= 1.11
NO_TEST= Yes
pre-configure:
cd ${WRKSRC} && ${SETENV} AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
AUTOCONF_VERSION=${AUTOCONF_VERSION} autoreconf --force --install
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
SHA256 (libtar-1.2.11.tar.gz) = Si7vtrcIj0HeVzVuUFnL8fkXUJtKgQ98YUYlo3joe7g=
SIZE (libtar-1.2.11.tar.gz) = 145354
SHA256 (libtar-1.2.20.tar.gz) = MVL8Yc8DyC77+ZZFWW79rbopfqw+haUq4YmQKgcsmhY=
SIZE (libtar-1.2.20.tar.gz) = 63544

View File

@ -1,35 +0,0 @@
$OpenBSD: patch-lib_Makefile_in,v 1.3 2013/10/10 07:02:56 jasper Exp $
Enable shared library, from pkgsrc.
--- lib/Makefile.in.orig Sun Dec 15 19:02:30 2002
+++ lib/Makefile.in Thu Oct 10 08:59:32 2013
@@ -69,13 +69,15 @@ all: ${ALL}
.PHONY: clean distclean install
libtar.a: ${LIBTAR_OBJS} ${LIBOBJS}
- ${AR} rc libtar.a ${LIBTAR_OBJS} ${LIBOBJS}
- ${RANLIB} libtar.a
+ ${LIBTOOL} --mode=link --tag=CC \
+ ${CC} -o libtar.la ${LIBTAR_OBJS:.o=.lo} ${LIBOBJS:.o=.lo} \
+ ${LDFLAGS} -rpath ${TRUEPREFIX}/lib -version-info 1:2
${LIBTAR_OBJS}: ${LIBTAR_HDRS}
.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
+ ${LIBTOOL} --mode=compile --tag=CC \
+ ${CC} ${CFLAGS} ${CPPFLAGS} -c -o ${@:.o=.lo} $< -prefer-pic
clean:
rm -f *~ *.o ${ALL} core
@@ -85,7 +87,8 @@ distclean: clean
install: ${ALL}
${MKDIR} ${DESTDIR}${libdir}
- ${INSTALL_DATA} libtar.a ${DESTDIR}${libdir}
+ ${LIBTOOL} --mode=install \
+ ${INSTALL_DATA} libtar.la ${DESTDIR}${libdir}
${MKDIR} ${DESTDIR}${includedir}
${INSTALL_DATA} ${srcdir}/libtar.h ${DESTDIR}${includedir}
${INSTALL_DATA} ../listhash/libtar_listhash.h ${DESTDIR}${includedir}

View File

@ -1,85 +0,0 @@
$OpenBSD: patch-lib_block_c,v 1.1 2013/10/10 07:16:28 jasper Exp $
Security fix for CVE-2013-4397 Integer overflow in libtar
Patch from http://repo.or.cz/w/libtar.git/commit/45448e8bae671c2f7e80b860ae0fc0cedf2bdc04
--- lib/block.c.orig Tue Jan 7 02:40:59 2003
+++ lib/block.c Thu Oct 10 08:59:51 2013
@@ -90,8 +90,8 @@ th_read_internal(TAR *t)
int
th_read(TAR *t)
{
- int i, j;
- size_t sz;
+ int i;
+ size_t sz, j, blocks;
char *ptr;
#ifdef DEBUG
@@ -118,21 +118,26 @@ th_read(TAR *t)
if (TH_ISLONGLINK(t))
{
sz = th_get_size(t);
- j = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0);
+ blocks = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0);
+ if (blocks > ((size_t)-1 / T_BLOCKSIZE))
+ {
+ errno = E2BIG;
+ return -1;
+ }
#ifdef DEBUG
printf(" th_read(): GNU long linkname detected "
- "(%ld bytes, %d blocks)\n", sz, j);
+ "(%ld bytes, %d blocks)\n", sz, blocks);
#endif
- t->th_buf.gnu_longlink = (char *)malloc(j * T_BLOCKSIZE);
+ t->th_buf.gnu_longlink = (char *)malloc(blocks * T_BLOCKSIZE);
if (t->th_buf.gnu_longlink == NULL)
return -1;
- for (ptr = t->th_buf.gnu_longlink; j > 0;
- j--, ptr += T_BLOCKSIZE)
+ for (j = 0, ptr = t->th_buf.gnu_longlink; j < blocks;
+ j++, ptr += T_BLOCKSIZE)
{
#ifdef DEBUG
printf(" th_read(): reading long linkname "
- "(%d blocks left, ptr == %ld)\n", j, ptr);
+ "(%d blocks left, ptr == %ld)\n", blocks-j, ptr);
#endif
i = tar_block_read(t, ptr);
if (i != T_BLOCKSIZE)
@@ -163,21 +168,26 @@ th_read(TAR *t)
if (TH_ISLONGNAME(t))
{
sz = th_get_size(t);
- j = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0);
+ blocks = (sz / T_BLOCKSIZE) + (sz % T_BLOCKSIZE ? 1 : 0);
+ if (blocks > ((size_t)-1 / T_BLOCKSIZE))
+ {
+ errno = E2BIG;
+ return -1;
+ }
#ifdef DEBUG
printf(" th_read(): GNU long filename detected "
- "(%ld bytes, %d blocks)\n", sz, j);
+ "(%ld bytes, %d blocks)\n", sz, blocks);
#endif
- t->th_buf.gnu_longname = (char *)malloc(j * T_BLOCKSIZE);
+ t->th_buf.gnu_longname = (char *)malloc(blocks * T_BLOCKSIZE);
if (t->th_buf.gnu_longname == NULL)
return -1;
- for (ptr = t->th_buf.gnu_longname; j > 0;
- j--, ptr += T_BLOCKSIZE)
+ for (j = 0, ptr = t->th_buf.gnu_longname; j < blocks;
+ j++, ptr += T_BLOCKSIZE)
{
#ifdef DEBUG
printf(" th_read(): reading long filename "
- "(%d blocks left, ptr == %ld)\n", j, ptr);
+ "(%d blocks left, ptr == %ld)\n", blocks-j, ptr);
#endif
i = tar_block_read(t, ptr);
if (i != T_BLOCKSIZE)

View File

@ -1,40 +0,0 @@
$OpenBSD: patch-libtar_Makefile_in,v 1.1.1.1 2010/04/16 13:10:47 ajacoutot Exp $
Enable shared library, from pkgsrc.
--- libtar/Makefile.in.orig Sun Dec 15 19:02:30 2002
+++ libtar/Makefile.in Thu Apr 15 17:58:09 2010
@@ -45,7 +45,7 @@ LIBTAR_HDRS = ../config.h \
${top_srcdir}/compat/compat.h \
${top_srcdir}/lib/libtar.h \
../listhash/libtar_listhash.h
-LIBTAR_LIBS = ../lib/libtar.a
+LIBTAR_LIBS = ../lib/libtar.la
ALL = libtar
@@ -54,12 +54,15 @@ all: ${ALL}
.PHONY: clean distclean install
libtar: ${LIBTAR_OBJS} ${LIBTAR_LIBS} ${LIBTAR_HDRS}
- ${CC} ${CFLAGS} ${LDFLAGS} -o libtar libtar.o ${LIBTAR_LIBS} ${LIBS}
+ ${LIBTOOL} --mode=link --tag=CC \
+ ${CC} ${CFLAGS} ${LDFLAGS} -o libtar libtar.lo \
+ ${LIBTAR_LIBS} ${LIBS}
${LIBTAR_OBJS}: ${LIBTAR_HDRS}
.c.o:
- ${CC} ${CFLAGS} ${CPPFLAGS} -c -o $@ $<
+ ${LIBTOOL} --mode=compile \
+ ${CC} ${CFLAGS} ${CPPFLAGS} -c -o ${@:.o=.lo} $< -prefer-pic
clean:
rm -f *~ *.o ${ALL} core
@@ -69,5 +72,5 @@ distclean: clean
install: ${ALL}
${MKDIR} ${DESTDIR}${bindir}
- ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir}
+ ${LIBTOOL} --mode=install ${INSTALL_PROGRAM} libtar ${DESTDIR}${bindir}