diff options
-rwxr-xr-x | monitor-parse-edid | 7 |
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"); |