aboutsummaryrefslogtreecommitdiffstats
path: root/monitor-parse-edid
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mandriva.org>2010-01-03 14:26:11 +0000
committerAnssi Hannula <anssi@mandriva.org>2010-01-03 14:26:11 +0000
commit66d7228d3bdba031331ef4d2852ff49c533456b4 (patch)
tree7e55e700cbf213f266abd243672ce1b29cde50aa /monitor-parse-edid
parent2cafc018717865f17566139dd22f293270881b0a (diff)
downloadmonitor-edid-66d7228d3bdba031331ef4d2852ff49c533456b4.tar
monitor-edid-66d7228d3bdba031331ef4d2852ff49c533456b4.tar.gz
monitor-edid-66d7228d3bdba031331ef4d2852ff49c533456b4.tar.bz2
monitor-edid-66d7228d3bdba031331ef4d2852ff49c533456b4.tar.xz
monitor-edid-66d7228d3bdba031331ef4d2852ff49c533456b4.zip
fix new length checks for 0 length input
Diffstat (limited to 'monitor-parse-edid')
-rwxr-xr-xmonitor-parse-edid7
1 files changed, 5 insertions, 2 deletions
diff --git a/monitor-parse-edid b/monitor-parse-edid
index 9acbd9b..5a6f4f0 100755
--- a/monitor-parse-edid
+++ b/monitor-parse-edid
@@ -656,7 +656,9 @@ sub print_edid {
sub edid_from_lines {
my (@l) = @_;
my $edid_str = join('', map { /\s+([0-9a-f]{32})$/ && $1 } @l);
- length($edid_str) % (2 * 128) == 0 or return ();
+ if (length($edid_str) % (2 * 128) != 0 || length($edid_str) == 0) {
+ return ();
+ }
pack("C*", map { hex($_) } $edid_str =~ /(..)/g);
}
@@ -705,7 +707,8 @@ sub error {
}
my @raw_edids;
-if (length($input) % 128 == 0 && length($input) <= 128 * 254) {
+my $length = length($input);
+if ($length % 128 == 0 && $length >= 128 && $length <= 128 * 254) {
@raw_edids = $input;
} else {
@raw_edids = find_edid_in_string($input) or error("bad edid");