zip: don't add attributes when they don't fit.

* simply warns about the lack of room.
This commit is contained in:
Jerome Duval
2015-03-22 14:57:43 +00:00
parent 9e7046296b
commit 6a1e875c40
2 changed files with 39 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
From 9f5dfd330e7e1c99596813dcee03b691993994ae Mon Sep 17 00:00:00 2001
From a48f57e1c902b2e6ef2d946cfebf2da0637f9a88 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 28 Feb 2015 18:07:06 +0000
Subject: Haiku patch
@@ -466,7 +466,7 @@ index 439821f..6682e41 100644
1.8.3.4
From 7b74aa46f01c8a85d493511654a077c0c2df73d3 Mon Sep 17 00:00:00 2001
From d3e651b9d30d440eb46d63b8ddc4a3d1fc4ca3ad Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 2 Mar 2015 19:27:01 +0000
Subject: Haiku x86_64 fixes
@@ -528,3 +528,39 @@ index 970af5c..6a0cbe3 100644
--
1.8.3.4
From 6b6c66f091b513c313e68f35c16ad79891206521 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 22 Mar 2015 14:08:10 +0000
Subject: Haiku: warn if attrs total length exceeds extra field size
diff --git a/unix/unix.c b/unix/unix.c
index 6a0cbe3..b6d06d0 100644
--- a/unix/unix.c
+++ b/unix/unix.c
@@ -674,7 +674,7 @@ local int add_Be_ef( struct zlist far *z )
char *attrbuff = NULL;
off_t attrsize = 0;
char *compbuff = NULL;
- ush compsize = 0;
+ ulg compsize = 0;
uch flags = 0;
/* Check to make sure we've got enough room in the extra fields. */
@@ -732,8 +732,10 @@ local int add_Be_ef( struct zlist far *z )
}
/* Check to see if we really have enough room in the EF for the data. */
- if( ( z->ext + compsize + EB_L_BE_LEN ) > USHRT_MAX ) {
- compsize = USHRT_MAX - EB_L_BE_LEN - z->ext;
+ if( ( z->ext + compsize + EB_L_BE_SIZE ) > USHRT_MAX ) {
+ zipwarn("not enough space in extra field for attributes\n", "");
+ free( compbuff );
+ return ZE_MEM;
}
/* Allocate memory for the local and central extra fields. */
--
1.8.3.4

View File

@@ -7,7 +7,7 @@ incremental backups and multi-part archives.
HOMEPAGE="http://www.info-zip.org/Zip.html"
SRC_URI="http://downloads.sourceforge.net/project/infozip/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz"
CHECKSUM_SHA256="f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369"
REVISION="1"
REVISION="2"
LICENSE="Info-ZIP"
COPYRIGHT="1990-2008 Info-ZIP"