Skip to content

Commit

Permalink
minor: we can remove these checks because my_read () is now quarantee…
Browse files Browse the repository at this point in the history
…d to always return a string (cleanup)
  • Loading branch information
philsmd committed Feb 5, 2017
1 parent 2d105b9 commit fe800e0
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions 7z2hashcat.pl
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ sub get_uint32

my $bytes = my_read ($fp, 4);

return (0, 0) if (! defined ($bytes));
return (0, 0) if (length ($bytes) != 4);

my $num = unpack ("L", $bytes);
Expand All @@ -460,7 +459,6 @@ sub get_uint64

my $bytes = my_read ($fp, 8);

return (0, 0) if (! defined ($bytes));
return (0, 0) if (length ($bytes) != 8);

my ($uint1, $uint2) = unpack ("LL<", $bytes);
Expand Down Expand Up @@ -2784,14 +2782,12 @@ sub sfx_7z_pe_search

my $bytes = my_read ($fp, 2);

return 0 if (! defined ($bytes));
return 0 if (length ($bytes) != 2);
return 0 if ($bytes ne "MZ"); # 0x5a4d
return 0 if (length (my_read ($fp, 58)) != 58);

$bytes = my_read ($fp, 4);

return 0 if (! defined ($bytes));
return 0 if (length ($bytes) != 4);

my $e_lfanew = unpack ("L", $bytes);
Expand All @@ -2802,14 +2798,12 @@ sub sfx_7z_pe_search

$bytes = my_read ($fp, 4); # PE0000 signature after DOS part

return 0 if (! defined ($bytes));
return 0 if (length ($bytes) != 4);
return 0 if ($bytes ne "PE\x00\x00");
return 0 if (length (my_read ($fp, 2)) != 2); # skip FileHeader.Machine

$bytes = my_read ($fp, 2);

return 0 if (! defined ($bytes));
return 0 if (length ($bytes) != 2);

my $num_sections = unpack ("S", $bytes);
Expand All @@ -2833,7 +2827,6 @@ sub sfx_7z_pe_search

$bytes = my_read ($fp, 4);

return 0 if (! defined ($bytes));
return 0 if (length ($bytes) != 4);

my $size_of_raw_data = unpack ("L", $bytes);
Expand All @@ -2842,7 +2835,6 @@ sub sfx_7z_pe_search

$bytes = my_read ($fp, 4);

return 0 if (! defined ($bytes));
return 0 if (length ($bytes) != 4);

my $pointer_to_raw_data = unpack ("L", $bytes);
Expand All @@ -2868,7 +2860,6 @@ sub sfx_7z_pe_search

$bytes = my_read ($fp, $SEVEN_ZIP_MAGIC_LEN);

return 0 if (! defined ($bytes));
return 0 if (length ($bytes) != $SEVEN_ZIP_MAGIC_LEN);

if ($bytes eq $SEVEN_ZIP_MAGIC)
Expand Down Expand Up @@ -2931,7 +2922,6 @@ sub sfx_7z_full_search
{
my $bytes = my_read ($fp, $SEVEN_ZIP_MAGIC_LEN);

last if (! defined ($bytes));
last if (length ($bytes) == 0);

$prev_idx_into_magic = $idx_into_magic;
Expand Down

0 comments on commit fe800e0

Please sign in to comment.