summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-11-26 12:38:04 -0800
committerAlexander Amelkin <mocbuhtig@amelkin.msk.ru>2019-02-13 21:28:14 +0300
commit6d515dd06bcb89598465cc69e89e37684577e289 (patch)
tree4d10ad59ef93867e42b5dc8e4aa104c653b221f0 /lib
parent7941806a9b7470e503d59f20713ef36269381ed2 (diff)
downloadipmitool-6d515dd06bcb89598465cc69e89e37684577e289.tar.gz
fru: fixup array bounds checking
Fixup the following array bounds checking bugs: [lib/ipmi_fru.c:1003]: (style) Array index 'i' is used before limits check. [lib/ipmi_fru.c:1127]: (style) Array index 'i' is used before limits check. [lib/ipmi_fru.c:1262]: (style) Array index 'i' is used before limits check. Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/ipmi_fru.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/ipmi_fru.c b/lib/ipmi_fru.c
index e839ad2..51b1234 100644
--- a/lib/ipmi_fru.c
+++ b/lib/ipmi_fru.c
@@ -1000,8 +1000,7 @@ fru_area_print_chassis(struct ipmi_intf * intf, struct fru_info * fru,
}
/* read any extra fields */
- while ((fru_data[i] != 0xc1) && (i < fru_len))
- {
+ while ((i < fru_len) && (fru_data[i] != FRU_END_OF_FIELDS)) {
int j = i;
fru_area = get_fru_area_str(fru_data, &i);
if (fru_area) {
@@ -1124,8 +1123,7 @@ fru_area_print_board(struct ipmi_intf * intf, struct fru_info * fru,
}
/* read any extra fields */
- while ((fru_data[i] != 0xc1) && (i < fru_len))
- {
+ while ((i < fru_len) && (fru_data[i] != FRU_END_OF_FIELDS)) {
int j = i;
fru_area = get_fru_area_str(fru_data, &i);
if (fru_area) {
@@ -1259,8 +1257,7 @@ fru_area_print_product(struct ipmi_intf * intf, struct fru_info * fru,
}
/* read any extra fields */
- while ((fru_data[i] != 0xc1) && (i < fru_len))
- {
+ while ((i < fru_len) && (fru_data[i] != FRU_END_OF_FIELDS)) {
int j = i;
fru_area = get_fru_area_str(fru_data, &i);
if (fru_area) {