i2c-tools/decode-dimms-correctly-check-for-out-of-bounds-vendor-id.patch
Jean Delvare 408f62f373 - decode-dimms-correctly-check-for-out-of-bounds-vendor-id.patch:
Fix recommended by upstream.

- Update the URL.
- Remove authors list from package description, it does not belong
  there.

OBS-URL: https://build.opensuse.org/package/show/Base:System/i2c-tools?expand=0&rev=40
2017-07-06 10:57:50 +00:00

28 lines
997 B
Diff

From: Jean Delvare <jdelvare@suse.de>
Date: Thu, 23 Jun 2016 18:59:07 +0200
Subject: decode-dimms: Correctly check for out-of-bounds vendor ID
Upstream: yes
Git-commit: 2b4135907c1aa27edeb397e62b67386ff5d7d3d5
---
eeprom/decode-dimms | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- i2c-tools-3.1.2.orig/eeprom/decode-dimms 2017-07-06 12:55:49.998319548 +0200
+++ i2c-tools-3.1.2/eeprom/decode-dimms 2017-07-06 12:55:51.398337567 +0200
@@ -343,9 +343,11 @@ sub manufacturer_ddr3($$)
{
my ($count, $code) = @_;
return "Invalid" if parity($count) != 1;
- return "Invalid" if parity($code) != 1;
- return (($code & 0x7F) - 1 > $vendors[$count & 0x7F]) ? "Unknown" :
- $vendors[$count & 0x7F][($code & 0x7F) - 1];
+ return "Invalid" if parity($code) != 1
+ or ($code & 0x7F) == 0;
+ return "Unknown" if ($count & 0x7F) >= @vendors
+ or ($code & 0x7F) - 1 >= @{$vendors[$count & 0x7F]};
+ return $vendors[$count & 0x7F][($code & 0x7F) - 1];
}
sub manufacturer(@)