ports/sysutils/e2fsprogs/files/patch-lib__uuid__gen_uuid.c
Matthias Andree f352bb8973 sysutils/e2fsprogs: Update to 1.45.6
Add three patches (one was extended) by Ted Y. Ts'o to fix various
issues (loff_t and type related).

Drop our own obsolete patches.

While here, drop obsolete parts of some of our patches
(malloc.h -> stdlib.h).

Since the online release notes are not available yet,
this is from doc/RelNotes/v1.45.6.txt, omitting Linux-/Hurd-specifics.

UI and Features
---------------
Debugfs will ignore lines in its command files which start with a
comment character ("#").

Fixes
-----
Fixed a number of potential out of bounds memory accesses caused by
fuzzed / malicious file systems.  (Addresses Google Bug: #147849134)

Fix a spurious complaint from e2fsck when a directory which previously
had more than 32000 subdirectories has the number of subdirectories
drops below 32000.

Mke2fs -d now correctly sets permission with files where the owner
permissions are not rwx.

Improve e2fsck's ability to deal with file systems with very large
number of directories, such that various data structures take more than
2GiB of memory.  Use better structure packing to improve the memory
efficiency of these data structures.

Fix debugfs so it correctly prints inode numbers > 2**31.

Filefrag now supports very large files (with > 4 billion blocks), as
well as block sizes up to 1 GiB.

Updated and clarified various man pages.  (Addresses Debian Bugs:
#953493, #953494, #951808)

Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Reserved the error code EXT2_ET_NO_GDESC (which will be used in
e2fsprogs v1.46+)

Added a thread-safe variant of e2p_feature2string(),
e2p_feature_to_string() to the libe2p library.

Fixed portability problems caused by gcc 10.

Synchronized changes from Android's AOSP e2fsprogs tree.

Update the Malay translation from the translation project.

Obtained from:	tytso@mit.edu (files/patch-0-tytso*)
MFH:		2020Q1
2020-03-23 09:42:54 +00:00

57 lines
1.3 KiB
C

--- lib/uuid/gen_uuid.c.orig 2020-03-21 04:24:04 UTC
+++ lib/uuid/gen_uuid.c
@@ -94,6 +94,7 @@
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
+#include <ifaddrs.h>
#include "uuidP.h"
#include "uuidd.h"
@@ -300,6 +301,28 @@ static int get_node_id(unsigned char *node_id)
}
}
close(sd);
+#else
+ struct ifaddrs *ifaddrsp, *ifaddrp;
+ unsigned char *a;
+
+ if (getifaddrs(&ifaddrsp) < 0)
+ return -1;
+ for (ifaddrp = ifaddrsp; ifaddrp != NULL; ifaddrp = ifaddrp->ifa_next)
+ {
+ if (ifaddrp->ifa_addr == NULL)
+ continue;
+ if (ifaddrp->ifa_addr->sa_family != AF_LINK)
+ continue;
+ a = LLADDR((struct sockaddr_dl *)ifaddrp->ifa_addr);
+ if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
+ continue;
+ if (node_id) {
+ memcpy(node_id, a, 6);
+ freeifaddrs(ifaddrsp);
+ return 1;
+ }
+ }
+ freeifaddrs(ifaddrsp);
#endif
return 0;
}
@@ -484,7 +507,7 @@ static void close_all_fds(void)
}
#endif /* defined(USE_UUIDD) && defined(HAVE_SYS_UN_H) */
-#if __GNUC_PREREQ (4, 6)
+#if __GNUC_PREREQ__ (4, 6)
#pragma GCC diagnostic push
#if !defined(USE_UUIDD) || !defined(HAVE_SYS_UN_H)
#pragma GCC diagnostic ignored "-Wunused-parameter"
@@ -572,7 +595,7 @@ fail:
#endif
return -1;
}
-#if __GNUC_PREREQ (4, 6)
+#if __GNUC_PREREQ__ (4, 6)
#pragma GCC diagnostic pop
#endif