ipmitool/0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch
Thomas Renninger e7e8d0d141 - Update to latest git HEAD version adding quite some fixes (fate##321578)
* Add:
0001-fix-typo.patch
0002-added-microTCA-major-version.patch
0003-replaced-removed-defines-which-are-already-present-i.patch
0004-fix-typo.patch
0005-fix-typo.patch
0006-ID-461-OpenSSL-1.1-compatibility-error-storage-size-.patch
0007-ID-461-Make-compiler-happier-about-changes-related-t.patch
0008-ID-474-Compile-fix-on-nonlinux-systems.patch
0009-Add-bootstrap-support-for-Mac.patch
0010-Prevent-autoreconf-from-complaining-about-missing-NE.patch
0011-Add-git-hash-and-dirty-mark-to-ipmitool-version.patch
0012-Add-some-more-configure-build-editor-byproducts-to-..patch
0013-ID-478-ekanalyzer-Fixed-decoding-of-FRU-fields.patch
0014-ID-479-ekanalyzer-fix-processing-of-custom-mfg.-fiel.patch
0015-ID-477-fru-Fix-decoding-of-non-text-data-in-get_fru_.patch
0016-Make-git-revision-more-descriptive.patch
0017-ID-480-ipmitool-coredumps-in-EVP_CIPHER_CTX_init.patch

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/ipmitool?expand=0&rev=40
2017-03-28 16:43:34 +00:00

70 lines
2.4 KiB
Diff

From 7b0302cef5b7f22bd707f0d07c4098d7a6c57aa6 Mon Sep 17 00:00:00 2001
From: Alexander Amelkin <alexander@amelkin.msk.ru>
Date: Tue, 24 Jan 2017 14:09:57 +0300
Subject: [PATCH 14/17] ID:479 - ekanalyzer: fix processing of custom mfg.
fields
Ekanalyzer was not reading the type/length byte for the 2nd and
subsequent custom fields. Also the message it displayed when
lacked data for custom fields was very relaxing and incorrect.
---
lib/ipmi_ekanalyzer.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/lib/ipmi_ekanalyzer.c b/lib/ipmi_ekanalyzer.c
index 35aa850..f6d8b90 100644
--- a/lib/ipmi_ekanalyzer.c
+++ b/lib/ipmi_ekanalyzer.c
@@ -2697,6 +2697,7 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
int ret = 0;
unsigned char len = 0;
unsigned int size_board = 0;
+ int custom_fields = 0;
if (input_file == NULL || board_type == NULL
|| board_length == NULL) {
return (size_t)(-1);
@@ -2758,7 +2759,12 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
/* take the rest of data in the area minus 1 byte of
* checksum
*/
- printf("Additional Custom Mfg. length: 0x%02x\n", len);
+ if (custom_fields) {
+ printf("End of Custom Mfg. fields (0x%02x)\n", len);
+ } else {
+ printf("No Additional Custom Mfg. fields (0x%02x)\n", len);
+ }
+
padding = (*board_length) - 1;
if ((padding > 0) && (!feof(input_file))) {
printf("Unused space: %d (bytes)\n", padding);
@@ -2772,6 +2778,7 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
printf("Checksum: 0x%02x\n", checksum);
goto out;
}
+ custom_fields++;
printf("Additional Custom Mfg. length: 0x%02x\n", len);
if ((size_board > 0) && (size_board < (*board_length))) {
unsigned char *additional_data, *str;
@@ -2801,9 +2808,17 @@ ipmi_ek_display_board_info_area(FILE *input_file, char *board_type,
additional_data = NULL;
(*board_length) -= size_board;
+ ret = fread(&len, 1, 1, input_file);
+ if ((ret != 1) || ferror(input_file)) {
+ lprintf(LOG_ERR, "Invalid Length!");
+ goto out;
+ }
+ (*board_length)--;
+ size_board = (len & 0x3f);
}
else {
- printf("No Additional Custom Mfg. %d\n", *board_length);
+ printf("ERROR: File has insufficient data (%d bytes) for the "
+ "Additional Custom Mfg. field\n", *board_length);
goto out;
}
}
--
1.8.5.6