summaryrefslogtreecommitdiff
path: root/debian/patches/0155-use_read_file.patch
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-08-17 17:29:08 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-08-17 17:29:08 +0200
commit0a2ec421e07880e4e7649952e008259c53486f62 (patch)
treed6fd478d7c5565218ac1d8747869518d8f27b8a1 /debian/patches/0155-use_read_file.patch
parent2086c5dde19124c775a3cc1dfdd517e60661ca6a (diff)
parente791bb035e146432e8681c0308bec5df74281ce3 (diff)
Merge branch 'release/debian/3.5-2'debian/3.5-2
Diffstat (limited to 'debian/patches/0155-use_read_file.patch')
-rw-r--r--debian/patches/0155-use_read_file.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/debian/patches/0155-use_read_file.patch b/debian/patches/0155-use_read_file.patch
new file mode 100644
index 0000000..18b1fb3
--- /dev/null
+++ b/debian/patches/0155-use_read_file.patch
@@ -0,0 +1,43 @@
+Description: Use read_file() instead of mem_chunk()
+Origin: upstream, https://git.savannah.gnu.org/cgit/dmidecode.git/commit/?id=c76ddda0ba0aa99a55945e3290095c2ec493c892
+Forwarded: not-needed
+Last-Update: 2023-07-15
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+Index: trunk/dmidecode.c
+===================================================================
+--- trunk.orig/dmidecode.c
++++ trunk/dmidecode.c
+@@ -6025,15 +6025,23 @@ int main(int argc, char * const argv[])
+ pr_comment("dmidecode %s", VERSION);
+
+ /* Read from dump if so instructed */
++ size = 0x20;
+ if (opt.flags & FLAG_FROM_DUMP)
+ {
+ if (!(opt.flags & FLAG_QUIET))
+ pr_info("Reading SMBIOS/DMI data from file %s.",
+ opt.dumpfile);
+- if ((buf = mem_chunk(0, 0x20, opt.dumpfile)) == NULL)
++ if ((buf = read_file(0, &size, opt.dumpfile)) == NULL)
+ {
+ ret = 1;
+ goto exit_free;
++ }
++
++ /* Truncated entry point can't be processed */
++ if (size < 0x20)
++ {
++ ret = 1;
++ goto done;
+ }
+
+ if (memcmp(buf, "_SM3_", 5) == 0)
+@@ -6059,7 +6067,6 @@ int main(int argc, char * const argv[])
+ * contain one of several types of entry points, so read enough for
+ * the largest one, then determine what type it contains.
+ */
+- size = 0x20;
+ if (!(opt.flags & FLAG_NO_SYSFS)
+ && (buf = read_file(0, &size, SYS_ENTRY_FILE)) != NULL)
+ {