diff options
author | 2016-06-30 20:26:57 +0000 | |
---|---|---|
committer | 2018-05-31 23:31:18 +0200 | |
commit | d31c50870d0bee042ce660e445c9294a59a3a65b (patch) | |
tree | 6bfc0de3c95267b401b620c2c67859557dc60f97 /source/ap/dmidecode/patches | |
parent | 76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (diff) | |
download | current-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.gz current-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.xz |
Slackware 14.2slackware-14.2
Thu Jun 30 20:26:57 UTC 2016
Slackware 14.2 x86_64 stable is released!
The long development cycle (the Linux community has lately been living in
"interesting times", as they say) is finally behind us, and we're proud to
announce the release of Slackware 14.2. The new release brings many updates
and modern tools, has switched from udev to eudev (no systemd), and adds
well over a hundred new packages to the system. Thanks to the team, the
upstream developers, the dedicated Slackware community, and everyone else
who pitched in to help make this release a reality.
The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided
32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware
project by picking up a copy from store.slackware.com. We're taking
pre-orders now, and offer a discount if you sign up for a subscription.
Have fun! :-)
Diffstat (limited to 'source/ap/dmidecode/patches')
9 files changed, 585 insertions, 0 deletions
diff --git a/source/ap/dmidecode/patches/0001-Add-no-sysfs-option-description-to-h-output.patch b/source/ap/dmidecode/patches/0001-Add-no-sysfs-option-description-to-h-output.patch new file mode 100644 index 000000000..35b029742 --- /dev/null +++ b/source/ap/dmidecode/patches/0001-Add-no-sysfs-option-description-to-h-output.patch @@ -0,0 +1,39 @@ +From 33b5aafc6ee6b5de9f2526fb1cf4b14d1e16e4f0 Mon Sep 17 00:00:00 2001 +From: Roy Franz <roy.franz@linaro.org> +Date: Thu, 1 Oct 2015 08:41:43 +0200 +Subject: [PATCH 1/9] Add "--no-sysfs" option description to -h output + +A description of --no-sysfs was not added to the output of "-h" when +the feature was added, so add it now. +--- + CHANGELOG | 4 ++++ + dmiopt.c | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index f0a51a4..42d815c 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,7 @@ ++2015-10-01 Roy Franz <roy.franz@linaro.org> ++ ++ * dmiopt.c: Add "--no-sysfs" option description to -h output. ++ + 2015-09-03 Jean Delvare <jdelvare@suse.de> + + * version.h: Set version to 3.0. +diff --git a/dmiopt.c b/dmiopt.c +index 0d142d2..de607f4 100644 +--- a/dmiopt.c ++++ b/dmiopt.c +@@ -314,6 +314,7 @@ void print_help(void) + " -u, --dump Do not decode the entries\n" + " --dump-bin FILE Dump the DMI data to a binary file\n" + " --from-dump FILE Read the DMI data from a binary file\n" ++ " --no-sysfs Do not attempt to read DMI data from sysfs files\n" + " -V, --version Display the version and exit\n"; + + printf("%s", help); +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0002-Avoid-SIGBUS-on-mmap-failure.patch b/source/ap/dmidecode/patches/0002-Avoid-SIGBUS-on-mmap-failure.patch new file mode 100644 index 000000000..924a2ffef --- /dev/null +++ b/source/ap/dmidecode/patches/0002-Avoid-SIGBUS-on-mmap-failure.patch @@ -0,0 +1,74 @@ +From c081fa410e7c466df4b3b257e7b974b71fb7f250 Mon Sep 17 00:00:00 2001 +From: Jean Delvare <jdelvare@suse.de> +Date: Wed, 14 Oct 2015 14:37:04 +0200 +Subject: [PATCH 2/9] Avoid SIGBUS on mmap failure + +mmap will fail with SIGBUS if trying to map a non-existent portion of +a file. While this should never happen with /dev/mem, it can happen if +passing a regular file with option -d. While people should no longer +do that, failure gracefully seems better than crashing. So check for +the file size before calling mmap. + +This closes bug #46066: +http://savannah.nongnu.org/bugs/?46066 +--- + CHANGELOG | 6 ++++++ + util.c | 21 +++++++++++++++++++++ + 2 files changed, 27 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index 42d815c..aa1c28f 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,9 @@ ++2015-10-14 Jean Delvare <jdelvare@suse.de> ++ ++ * util.c: Avoid SIGBUS on mmap failure. ++ This fixes Savannah bug #46066: ++ https://savannah.nongnu.org/bugs/?46066 ++ + 2015-10-01 Roy Franz <roy.franz@linaro.org> + + * dmiopt.c: Add "--no-sysfs" option description to -h output. +diff --git a/util.c b/util.c +index 8cafe5c..5795d02 100644 +--- a/util.c ++++ b/util.c +@@ -152,6 +152,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) + void *p; + int fd; + #ifdef USE_MMAP ++ struct stat statbuf; + off_t mmoffset; + void *mmp; + #endif +@@ -169,6 +170,26 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) + } + + #ifdef USE_MMAP ++ if (fstat(fd, &statbuf) == -1) ++ { ++ fprintf(stderr, "%s: ", devmem); ++ perror("stat"); ++ free(p); ++ return NULL; ++ } ++ ++ /* ++ * mmap() will fail with SIGBUS if trying to map beyond the end of ++ * the file. ++ */ ++ if (S_ISREG(statbuf.st_mode) && base + (off_t)len > statbuf.st_size) ++ { ++ fprintf(stderr, "mmap: Can't map beyond end of file %s\n", ++ devmem); ++ free(p); ++ return NULL; ++ } ++ + #ifdef _SC_PAGESIZE + mmoffset = base % sysconf(_SC_PAGESIZE); + #else +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0003-Fix-error-paths-in-mem_chunk.patch b/source/ap/dmidecode/patches/0003-Fix-error-paths-in-mem_chunk.patch new file mode 100644 index 000000000..7b4e418e6 --- /dev/null +++ b/source/ap/dmidecode/patches/0003-Fix-error-paths-in-mem_chunk.patch @@ -0,0 +1,88 @@ +From 458f73d58c24a7addce82bf1e8bfb8c2554ca458 Mon Sep 17 00:00:00 2001 +From: Jean Delvare <jdelvare@suse.de> +Date: Wed, 14 Oct 2015 14:37:09 +0200 +Subject: [PATCH 3/9] Fix error paths in mem_chunk + +Use a common error path in function mem_chunk, to make sure it does +not leak memory and does not leave an opened file descriptor behind, +without duplicating the cleaning code. +--- + CHANGELOG | 1 + + util.c | 24 ++++++++++-------------- + 2 files changed, 11 insertions(+), 14 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index aa1c28f..c940c9f 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -3,6 +3,7 @@ + * util.c: Avoid SIGBUS on mmap failure. + This fixes Savannah bug #46066: + https://savannah.nongnu.org/bugs/?46066 ++ * util.c: Fix error paths in mem_chunk. + + 2015-10-01 Roy Franz <roy.franz@linaro.org> + +diff --git a/util.c b/util.c +index 5795d02..f97ac0d 100644 +--- a/util.c ++++ b/util.c +@@ -166,7 +166,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) + if ((p = malloc(len)) == NULL) + { + perror("malloc"); +- return NULL; ++ goto out; + } + + #ifdef USE_MMAP +@@ -174,8 +174,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) + { + fprintf(stderr, "%s: ", devmem); + perror("stat"); +- free(p); +- return NULL; ++ goto err_free; + } + + /* +@@ -186,8 +185,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) + { + fprintf(stderr, "mmap: Can't map beyond end of file %s\n", + devmem); +- free(p); +- return NULL; ++ goto err_free; + } + + #ifdef _SC_PAGESIZE +@@ -220,19 +218,17 @@ try_read: + { + fprintf(stderr, "%s: ", devmem); + perror("lseek"); +- free(p); +- return NULL; ++ goto err_free; + } + +- if (myread(fd, p, len, devmem) == -1) +- { +- free(p); +- return NULL; +- } ++ if (myread(fd, p, len, devmem) == 0) ++ goto out; ++ ++err_free: ++ free(p); ++ p = NULL; + +-#ifdef USE_MMAP + out: +-#endif + if (close(fd) == -1) + perror(devmem); + +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0004-dmidecode-Handle-OEM-specific-types-in-group-associa.patch b/source/ap/dmidecode/patches/0004-dmidecode-Handle-OEM-specific-types-in-group-associa.patch new file mode 100644 index 000000000..fad90f3a9 --- /dev/null +++ b/source/ap/dmidecode/patches/0004-dmidecode-Handle-OEM-specific-types-in-group-associa.patch @@ -0,0 +1,40 @@ +From 3acecbbab8ecaf3e3b324a2286e51cf9d7950ad5 Mon Sep 17 00:00:00 2001 +From: Jean Delvare <jdelvare@suse.de> +Date: Tue, 20 Oct 2015 08:47:15 +0200 +Subject: [PATCH 4/9] dmidecode: Handle OEM-specific types in group + associations + +--- + CHANGELOG | 5 +++++ + dmidecode.c | 2 ++ + 2 files changed, 7 insertions(+) + +diff --git a/CHANGELOG b/CHANGELOG +index c940c9f..2aa1082 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,8 @@ ++2015-10-20 Jean Delvare <jdelvare@suse.de> ++ ++ * dmidecode.c: Handle OEM-specific types in group associations ++ (DMI type 14). ++ + 2015-10-14 Jean Delvare <jdelvare@suse.de> + + * util.c: Avoid SIGBUS on mmap failure. +diff --git a/dmidecode.c b/dmidecode.c +index f41c85b..ce0511b 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -172,6 +172,8 @@ static const char *dmi_smbios_structure_type(u8 code) + "Management Controller Host Interface", /* 42 */ + }; + ++ if (code >= 128) ++ return "OEM-specific"; + if (code <= 42) + return type[code]; + return out_of_spec; +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0005-Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch b/source/ap/dmidecode/patches/0005-Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch new file mode 100644 index 000000000..a0eb37898 --- /dev/null +++ b/source/ap/dmidecode/patches/0005-Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch @@ -0,0 +1,63 @@ +From bf7bad24ce141dab5b5acc3ffb98ce5fe4a8e0f9 Mon Sep 17 00:00:00 2001 +From: Xie XiuQi <xiexiuqi@huawei.com> +Date: Wed, 21 Oct 2015 15:12:50 +0200 +Subject: [PATCH 5/9] Fix 'No SMBIOS nor DMI entry point found' on SMBIOS3 + +address_from_efi may return a SMBIOS or SMBIOS3 format entry +point, so add this condition. +--- + AUTHORS | 1 + + CHANGELOG | 4 ++++ + dmidecode.c | 12 ++++++++++-- + 3 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/AUTHORS b/AUTHORS +index d4badfa..ccf7fbb 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -19,6 +19,7 @@ Jarod Wilson <jarod@redhat.com> + Anton Arapov <anton@redhat.com> + Roy Franz <roy.franz@linaro.org> + Tyler Bell <tyler.bell@hp.com> ++Xie XiuQi <xiexiuqi@huawei.com> + + MANY THANKS TO (IN CHRONOLOGICAL ORDER) + Werner Heuser +diff --git a/CHANGELOG b/CHANGELOG +index 2aa1082..be2092a 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,7 @@ ++2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> ++ ++ * dmidecode.c: Handle SMBIOS 3.0 entry points on EFI systems. ++ + 2015-10-20 Jean Delvare <jdelvare@suse.de> + + * dmidecode.c: Handle OEM-specific types in group associations +diff --git a/dmidecode.c b/dmidecode.c +index ce0511b..cfcade4 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -4866,8 +4866,16 @@ int main(int argc, char * const argv[]) + goto exit_free; + } + +- if (smbios_decode(buf, opt.devmem, 0)) +- found++; ++ if (memcmp(buf, "_SM3_", 5) == 0) ++ { ++ if (smbios3_decode(buf, opt.devmem, 0)) ++ found++; ++ } ++ else if (memcmp(buf, "_SM_", 4) == 0) ++ { ++ if (smbios_decode(buf, opt.devmem, 0)) ++ found++; ++ } + goto done; + + memory_scan: +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0006-dmidecode-Introduce-SYS_FIRMWARE_DIR.patch b/source/ap/dmidecode/patches/0006-dmidecode-Introduce-SYS_FIRMWARE_DIR.patch new file mode 100644 index 000000000..8e03c89e5 --- /dev/null +++ b/source/ap/dmidecode/patches/0006-dmidecode-Introduce-SYS_FIRMWARE_DIR.patch @@ -0,0 +1,31 @@ +From 2330b708a6d57fd2b8b7e353dd64d037f980a042 Mon Sep 17 00:00:00 2001 +From: Jean Delvare <jdelvare@suse.de> +Date: Mon, 2 Nov 2015 09:45:13 +0100 +Subject: [PATCH 6/9] dmidecode: Introduce SYS_FIRMWARE_DIR + +Have SYS_FIRMWARE_DIR point to the sysfs directory where our files +live, and use it in the definition of their paths. This makes it +easier to temporarily point somewhere else for debugging. +--- + dmidecode.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index cfcade4..183ced4 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -74,8 +74,9 @@ static const char *bad_index = "<BAD INDEX>"; + #define FLAG_NO_FILE_OFFSET (1 << 0) + #define FLAG_STOP_AT_EOT (1 << 1) + +-#define SYS_ENTRY_FILE "/sys/firmware/dmi/tables/smbios_entry_point" +-#define SYS_TABLE_FILE "/sys/firmware/dmi/tables/DMI" ++#define SYS_FIRMWARE_DIR "/sys/firmware/dmi/tables" ++#define SYS_ENTRY_FILE SYS_FIRMWARE_DIR "/smbios_entry_point" ++#define SYS_TABLE_FILE SYS_FIRMWARE_DIR "/DMI" + + /* + * Type-independant Stuff +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0007-Let-read_file-return-the-actual-data-size.patch b/source/ap/dmidecode/patches/0007-Let-read_file-return-the-actual-data-size.patch new file mode 100644 index 000000000..22e2f7241 --- /dev/null +++ b/source/ap/dmidecode/patches/0007-Let-read_file-return-the-actual-data-size.patch @@ -0,0 +1,112 @@ +From de9a74e1c60210bee229fcf55b1678a99d1b44dd Mon Sep 17 00:00:00 2001 +From: Jean Delvare <jdelvare@suse.de> +Date: Mon, 2 Nov 2015 09:45:26 +0100 +Subject: [PATCH 7/9] Let read_file return the actual data size + +Let read_file return the actual data size to the caller. This gives +the caller the possibility to check that the data size is as expected +and large enough for the purpose, and report to the user if not. +--- + CHANGELOG | 5 +++++ + dmidecode.c | 4 +++- + util.c | 11 +++++++---- + util.h | 2 +- + 4 files changed, 16 insertions(+), 6 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index be2092a..1e5437a 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -1,3 +1,8 @@ ++2015-11-02 Jean Delvare <jdelvare@suse.de> ++ ++ * dmidecode.c, util.c, util.h: Let read_file return the actual data ++ size. ++ + 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> + + * dmidecode.c: Handle SMBIOS 3.0 entry points on EFI systems. +diff --git a/dmidecode.c b/dmidecode.c +index 183ced4..a43cfd1 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -4751,6 +4751,7 @@ int main(int argc, char * const argv[]) + int ret = 0; /* Returned value */ + int found = 0; + off_t fp; ++ size_t size; + int efi; + u8 *buf; + +@@ -4820,8 +4821,9 @@ 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(0x20, SYS_ENTRY_FILE)) != NULL) ++ && (buf = read_file(&size, SYS_ENTRY_FILE)) != NULL) + { + if (!(opt.flags & FLAG_QUIET)) + printf("Getting SMBIOS data from sysfs.\n"); +diff --git a/util.c b/util.c +index f97ac0d..52ed413 100644 +--- a/util.c ++++ b/util.c +@@ -94,10 +94,11 @@ int checksum(const u8 *buf, size_t len) + * needs to be freed by the caller. + * This provides a similar usage model to mem_chunk() + * +- * Returns pointer to buffer of max_len bytes, or NULL on error ++ * Returns pointer to buffer of max_len bytes, or NULL on error, and ++ * sets max_len to the length actually read. + * + */ +-void *read_file(size_t max_len, const char *filename) ++void *read_file(size_t *max_len, const char *filename) + { + int fd; + size_t r2 = 0; +@@ -115,7 +116,7 @@ void *read_file(size_t max_len, const char *filename) + return(NULL); + } + +- if ((p = malloc(max_len)) == NULL) ++ if ((p = malloc(*max_len)) == NULL) + { + perror("malloc"); + return NULL; +@@ -123,7 +124,7 @@ void *read_file(size_t max_len, const char *filename) + + do + { +- r = read(fd, p + r2, max_len - r2); ++ r = read(fd, p + r2, *max_len - r2); + if (r == -1) + { + if (errno != EINTR) +@@ -140,6 +141,8 @@ void *read_file(size_t max_len, const char *filename) + while (r != 0); + + close(fd); ++ *max_len = r2; ++ + return p; + } + +diff --git a/util.h b/util.h +index 9d409cd..b8748f1 100644 +--- a/util.h ++++ b/util.h +@@ -25,7 +25,7 @@ + #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) + + int checksum(const u8 *buf, size_t len); +-void *read_file(size_t len, const char *filename); ++void *read_file(size_t *len, const char *filename); + void *mem_chunk(off_t base, size_t len, const char *devmem); + int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add); + u64 u64_range(u64 start, u64 end); +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch b/source/ap/dmidecode/patches/0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch new file mode 100644 index 000000000..f0dc5aed5 --- /dev/null +++ b/source/ap/dmidecode/patches/0008-dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch @@ -0,0 +1,86 @@ +From 364055211b1956539c6a6268e111e244e1292c8c Mon Sep 17 00:00:00 2001 +From: Jean Delvare <jdelvare@suse.de> +Date: Mon, 2 Nov 2015 09:45:31 +0100 +Subject: [PATCH 8/9] dmidecode: Use read_file() to read the DMI table from + sysfs + +We shouldn't use mem_chunk() to read the DMI table from sysfs. This +will fail for SMBIOS v3 implementations which specify a maximum length +for the table rather than its exact length. The kernel will trim the +table to the actual length, so the DMI file will be shorter than the +length announced in entry point. + +read_file() fits the bill in this case, as it deals with end of file +nicely. + +This also helps with corrupted DMI tables, as the kernel will not +export the part of the table that it wasn't able to parse, effectively +trimming it. + +This fixes bug #46176: +https://savannah.nongnu.org/bugs/?46176 +Unexpected end of file error +--- + CHANGELOG | 3 +++ + dmidecode.c | 29 +++++++++++++++++++++-------- + 2 files changed, 24 insertions(+), 8 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index 1e5437a..fcfc244 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -2,6 +2,9 @@ + + * dmidecode.c, util.c, util.h: Let read_file return the actual data + size. ++ * dmidecode.c: Use read_file to read the DMI table from sysfs. ++ This fixes Savannah bug #46176: ++ https://savannah.nongnu.org/bugs/?46176 + + 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> + +diff --git a/dmidecode.c b/dmidecode.c +index a43cfd1..16d1823 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -4524,16 +4524,29 @@ static void dmi_table(off_t base, u32 len, u16 num, u16 ver, const char *devmem, + printf("\n"); + } + +- /* +- * When we are reading the DMI table from sysfs, we want to print +- * the address of the table (done above), but the offset of the +- * data in the file is 0. When reading from /dev/mem, the offset +- * in the file is the address. +- */ + if (flags & FLAG_NO_FILE_OFFSET) +- base = 0; ++ { ++ /* ++ * When reading from sysfs, the file may be shorter than ++ * announced. For SMBIOS v3 this is expcted, as we only know ++ * the maximum table size, not the actual table size. For older ++ * implementations (and for SMBIOS v3 too), this would be the ++ * result of the kernel truncating the table on parse error. ++ */ ++ size_t size = len; ++ buf = read_file(&size, devmem); ++ if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)len) ++ { ++ printf("Wrong DMI structures length: %u bytes " ++ "announced, only %lu bytes available.\n", ++ len, (unsigned long)size); ++ } ++ len = size; ++ } ++ else ++ buf = mem_chunk(base, len, devmem); + +- if ((buf = mem_chunk(base, len, devmem)) == NULL) ++ if (buf == NULL) + { + fprintf(stderr, "Table is unreachable, sorry." + #ifndef USE_MMAP +-- +2.6.4 + diff --git a/source/ap/dmidecode/patches/0009-dmidecode-Check-sysfs-entry-point-length.patch b/source/ap/dmidecode/patches/0009-dmidecode-Check-sysfs-entry-point-length.patch new file mode 100644 index 000000000..6af8b3221 --- /dev/null +++ b/source/ap/dmidecode/patches/0009-dmidecode-Check-sysfs-entry-point-length.patch @@ -0,0 +1,52 @@ +From e5c73239404931d4d1b73eb595c3802fbce74c61 Mon Sep 17 00:00:00 2001 +From: Jean Delvare <jdelvare@suse.de> +Date: Mon, 2 Nov 2015 09:45:36 +0100 +Subject: [PATCH 9/9] dmidecode: Check sysfs entry point length + +Before passing the sysfs entry point data over for decoding, check +that its length meets the expectations. +--- + CHANGELOG | 1 + + dmidecode.c | 6 +++--- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/CHANGELOG b/CHANGELOG +index fcfc244..ba61cab 100644 +--- a/CHANGELOG ++++ b/CHANGELOG +@@ -5,6 +5,7 @@ + * dmidecode.c: Use read_file to read the DMI table from sysfs. + This fixes Savannah bug #46176: + https://savannah.nongnu.org/bugs/?46176 ++ * dmidecode.c: Check the sysfs entry point length. + + 2015-10-21 Xie XiuQi <xiexiuqi@huawei.com> + +diff --git a/dmidecode.c b/dmidecode.c +index 16d1823..b47c469 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -4840,17 +4840,17 @@ int main(int argc, char * const argv[]) + { + if (!(opt.flags & FLAG_QUIET)) + printf("Getting SMBIOS data from sysfs.\n"); +- if (memcmp(buf, "_SM3_", 5) == 0) ++ if (size >= 24 && memcmp(buf, "_SM3_", 5) == 0) + { + if (smbios3_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET)) + found++; + } +- else if (memcmp(buf, "_SM_", 4) == 0) ++ else if (size >= 31 && memcmp(buf, "_SM_", 4) == 0) + { + if (smbios_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET)) + found++; + } +- else if (memcmp(buf, "_DMI_", 5) == 0) ++ else if (size >= 15 && memcmp(buf, "_DMI_", 5) == 0) + { + if (legacy_decode(buf, SYS_TABLE_FILE, FLAG_NO_FILE_OFFSET)) + found++; +-- +2.6.4 + |