mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-05 06:33:50 +02:00
hfsprogs: add patches for (potential) issues
Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
This commit is contained in:
parent
82d9b53c3a
commit
5e52ac9aa4
4 changed files with 165 additions and 1 deletions
15
srcpkgs/hfsprogs/patches/fix-binary-and.patch
Normal file
15
srcpkgs/hfsprogs/patches/fix-binary-and.patch
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
Source: pullmoll
|
||||||
|
Upstream: no (should be reported)
|
||||||
|
Reason: needs binary and (&) to test for bit mask
|
||||||
|
|
||||||
|
--- fsck_hfs.tproj/dfalib/SBTree.c 2012-02-01 18:17:19.000000000 +0100
|
||||||
|
+++ fsck_hfs.tproj/dfalib/SBTree.c 2019-05-26 12:45:16.688514031 +0200
|
||||||
|
@@ -502,7 +502,7 @@
|
||||||
|
{
|
||||||
|
if ( recordSize != sizeof(HFSPlusCatalogFolder) )
|
||||||
|
return false;
|
||||||
|
- if ( (catalogRecord->hfsPlusFolder.flags && (kHFSFileLockedMask | kHFSThreadExistsMask)) != 0 )
|
||||||
|
+ if ( (catalogRecord->hfsPlusFolder.flags & (kHFSFileLockedMask | kHFSThreadExistsMask)) != 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
cNodeID = catalogRecord->hfsPlusFolder.folderID;
|
37
srcpkgs/hfsprogs/patches/fix-potential-buffer-overflow.patch
Normal file
37
srcpkgs/hfsprogs/patches/fix-potential-buffer-overflow.patch
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
Source: pullmoll
|
||||||
|
Upstream: no (feel free to suggest)
|
||||||
|
Reason: use snprintf to avoid potential buffer overruns and fix mis-typed != compare
|
||||||
|
|
||||||
|
--- fsck_hfs.tproj/utilities.c
|
||||||
|
+++ fsck_hfs.tproj/utilities.c
|
||||||
|
@@ -221,14 +221,12 @@
|
||||||
|
if ((dp = strrchr(name, '/')) == 0)
|
||||||
|
return (0);
|
||||||
|
*dp = 0;
|
||||||
|
- (void)strncpy(rawbuf, name, sizeof(rawbuf));
|
||||||
|
- *dp = '/';
|
||||||
|
#if LINUX
|
||||||
|
- (void)strncat(rawbuf, "/", sizeof(rawbuf));
|
||||||
|
+ snprintf(rawbuf, sizeof(rawbuf), "%s/%s", name, dp + 1);
|
||||||
|
#else
|
||||||
|
- (void)strncat(rawbuf, "/r", sizeof(rawbuf));
|
||||||
|
+ snprintf(rawbuf, sizeof(rawbuf), "%s/r%s", name, dp + 1);
|
||||||
|
#endif
|
||||||
|
- (void)strncat(rawbuf, &dp[1], sizeof(rawbuf));
|
||||||
|
+ *dp = '/';
|
||||||
|
|
||||||
|
return (rawbuf);
|
||||||
|
}
|
||||||
|
--- fsck_hfs.tproj/dfalib/SControl.c
|
||||||
|
+++ fsck_hfs.tproj/dfalib/SControl.c
|
||||||
|
@@ -321,9 +321,7 @@
|
||||||
|
dataArea.DrvNum = fsReadRef;
|
||||||
|
dataArea.liveVerifyState = liveMode;
|
||||||
|
dataArea.scanCount = scanCount;
|
||||||
|
- if (strncpy(dataArea.deviceNode, rdevnode, sizeof(dataArea.deviceNode)) != strlen(rdevnode)) {
|
||||||
|
- dataArea.deviceNode[0] = '\0';
|
||||||
|
- }
|
||||||
|
+ snprintf(dataArea.deviceNode, sizeof(dataArea.deviceNode), "%s", rdevnode);
|
||||||
|
|
||||||
|
/* there are cases where we cannot get the name of the volume so we */
|
||||||
|
/* set our default name to one blank */
|
112
srcpkgs/hfsprogs/patches/use-inttypes_h-formats.patch
Normal file
112
srcpkgs/hfsprogs/patches/use-inttypes_h-formats.patch
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
Source: pullmoll
|
||||||
|
Upstream: no
|
||||||
|
Reason: avoid format string mismatch for 64 bit types on 32/64 bit arch
|
||||||
|
|
||||||
|
--- newfs_hfs.tproj/newfs_hfs.c
|
||||||
|
+++ newfs_hfs.tproj/newfs_hfs.c
|
||||||
|
@@ -34,6 +34,7 @@
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <syslog.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
+#include <inttypes.h>
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/mount.h>
|
||||||
|
@@ -203,7 +203,7 @@
|
||||||
|
if (isdigit(optarg[0])) {
|
||||||
|
gJournalSize = get_num(optarg);
|
||||||
|
if (gJournalSize < 512*1024) {
|
||||||
|
- printf("%s: journal size %lldk too small. Reset to %dk.\n",
|
||||||
|
+ printf("%s: journal size %" PRId64 "k too small. Reset to %dk.\n",
|
||||||
|
progname, gJournalSize/1024, JOURNAL_DEFAULT_SIZE/1024);
|
||||||
|
gJournalSize = JOURNAL_DEFAULT_SIZE;
|
||||||
|
}
|
||||||
|
@@ -636,7 +636,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bit_index >= 22) {
|
||||||
|
- fatal("Error: Disk Device is too big (%llu sectors, %d bytes per sector", sectorCount, sectorSize);
|
||||||
|
+ fatal("Error: Disk Device is too big (%" PRIu64 " sectors, %d bytes per sector", sectorCount, sectorSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@@ -646,7 +646,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sectorCount / (gBlockSize / sectorSize)) > 0xFFFFFFFF) {
|
||||||
|
- fatal("%s: block size is too small for %lld sectors", optarg, gBlockSize, sectorCount);
|
||||||
|
+ fatal("%s: block size is too small for %" PRId64 " sectors", optarg, gBlockSize, sectorCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gBlockSize < HFSOPTIMALBLKSIZE) {
|
||||||
|
@@ -769,7 +769,7 @@
|
||||||
|
/* Check to see if the disk is too big */
|
||||||
|
u_int64_t secsize = (u_int64_t) dip.sectorSize;
|
||||||
|
if (bad_disk_size(dip.totalSectors, secsize)) {
|
||||||
|
- fatal("%s: partition is too big (maximum is %llu KB)", device, MAXHFSVOLSIZE/1024);
|
||||||
|
+ fatal("%s: partition is too big (maximum is %" PRIu64 " KB)", device, MAXHFSVOLSIZE/1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -904,7 +904,7 @@
|
||||||
|
min_size = dip->physSectorSize * (dip->physSectorSize / BLOCK_INFO_SIZE);
|
||||||
|
|
||||||
|
if (gJournalSize < min_size) {
|
||||||
|
- printf("%s: journal size %lldk too small. Reset to %dk.\n",
|
||||||
|
+ printf("%s: journal size %" PRId64 "k too small. Reset to %dk.\n",
|
||||||
|
progname, gJournalSize/1024, JOURNAL_DEFAULT_SIZE/1024);
|
||||||
|
gJournalSize = 0;
|
||||||
|
}
|
||||||
|
@@ -1055,7 +1055,7 @@
|
||||||
|
|
||||||
|
if (gNoCreate) {
|
||||||
|
if (gPartitionSize == 0)
|
||||||
|
- printf("%llu sectors (%u bytes per sector)\n", dip->physTotalSectors, dip->physSectorSize);
|
||||||
|
+ printf("%" PRIu64 " sectors (%u bytes per sector)\n", dip->physTotalSectors, dip->physSectorSize);
|
||||||
|
printf("HFS Plus format parameters:\n");
|
||||||
|
printf("\tvolume name: \"%s\"\n", gVolumeName);
|
||||||
|
printf("\tblock-size: %u\n", defaults->blockSize);
|
||||||
|
--- newfs_hfs.tproj/makehfs.c
|
||||||
|
+++ newfs_hfs.tproj/makehfs.c
|
||||||
|
@@ -55,6 +55,7 @@
|
||||||
|
#if !LINUX
|
||||||
|
#include <wipefs.h>
|
||||||
|
#endif
|
||||||
|
+#include <inttypes.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CommonCrypto is meant to be a more stable API than OpenSSL.
|
||||||
|
@@ -1380,10 +1381,10 @@
|
||||||
|
err(1, NULL);
|
||||||
|
}
|
||||||
|
else if (2 == status) {
|
||||||
|
- err(1, "read (sector %llu)", physSector);
|
||||||
|
+ err(1, "read (sector %" PRIu64 ")", physSector);
|
||||||
|
}
|
||||||
|
else if (3 == status) {
|
||||||
|
- err(1, "write (sector %llu)", physSector);
|
||||||
|
+ err(1, "write (sector %" PRIu64 ")", physSector);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
--- fsck_hfs.tproj/dfalib/CatalogCheck.c 2012-02-01 18:17:19.000000000 +0100
|
||||||
|
+++ fsck_hfs.tproj/dfalib/CatalogCheck.c 2019-05-26 13:03:31.395612279 +0200
|
||||||
|
@@ -25,6 +25,7 @@
|
||||||
|
#include "DecompDataEnums.h"
|
||||||
|
#include "DecompData.h"
|
||||||
|
|
||||||
|
+#include <inttypes.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
extern int RcdFCntErr( SGlobPtr GPtr, OSErr type, UInt32 correct, UInt32 incorrect, HFSCatalogNodeID);
|
||||||
|
@@ -1693,8 +1694,8 @@
|
||||||
|
} else {
|
||||||
|
fsckPrint(gScavGlobals->context, E_LEOF, filename);
|
||||||
|
}
|
||||||
|
- sprintf(oldSizeStr, "%qd", oldSize);
|
||||||
|
- sprintf(newSizeStr, "%qd", newSize);
|
||||||
|
+ sprintf(oldSizeStr, "%" PRIu64, oldSize);
|
||||||
|
+ sprintf(newSizeStr, "%" PRIu64, newSize);
|
||||||
|
fsckPrint(gScavGlobals->context, E_BadValue, newSizeStr, oldSizeStr);
|
||||||
|
|
||||||
|
/* Only HFS+ is repaired here */
|
|
@ -3,7 +3,7 @@ pkgname=hfsprogs
|
||||||
_distver=540.1
|
_distver=540.1
|
||||||
_patchver=3
|
_patchver=3
|
||||||
version="${_distver}.linux${_patchver}"
|
version="${_distver}.linux${_patchver}"
|
||||||
revision=3
|
revision=4
|
||||||
wrksrc="diskdev_cmds-${version}"
|
wrksrc="diskdev_cmds-${version}"
|
||||||
hostmakedepends="clang"
|
hostmakedepends="clang"
|
||||||
makedepends="libressl-devel libuuid-devel"
|
makedepends="libressl-devel libuuid-devel"
|
||||||
|
|
Loading…
Add table
Reference in a new issue