mrash / fwknop

Single Packet Authorization > Port Knocking

Home Page:http://www.cipherdyne.org/fwknop/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convert four variable assignments to the usage of combined operators

elfring opened this issue Β· comments

πŸ‘€ Some source code analysis tools can help to find opportunities for improving software components.
πŸ’­ I propose to increase the usage of combined operators accordingly.

diff --git a/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm b/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm
index 8548fcdc..4e618341 100644
--- a/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm
+++ b/perl/legacy/fwknop/deps/Crypt-CBC/CBC.pm
@@ -245,7 +245,7 @@ sub crypt (\$$){
 
     foreach my $block (@blocks) {
       if ($d) { # decrypting
-	$result .= $iv = $iv ^ $self->{'crypt'}->decrypt($block);
+	$result .= $iv ^= $self->{'crypt'}->decrypt($block);
 	$iv = $block unless $self->{pcbc};
       } else { # encrypting
 	$result .= $iv = $self->{'crypt'}->encrypt($iv ^ $block);
diff --git a/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm b/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm
index 5a7e5be1..56280a2b 100644
--- a/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm
+++ b/perl/legacy/fwknop/deps/Net-RawIP/lib/Net/RawIP.pm
@@ -510,7 +510,7 @@ sub bset {
         @{$self->{optsip}->type} = ();
         @{$self->{optsip}->len}  = ();
         @{$self->{optsip}->data} = ();
-        for(my $i=0; $i<=(@{${$self->{$proto_hdr}}[$n{$self->{proto}}]} - 2); $i = $i + 3) {
+        for(my $i=0; $i<=(@{${$self->{$proto_hdr}}[$n{$self->{proto}}]} - 2); $i += 3) {
             $self->{optsip}->type($j,
                 ${${$self->{$proto_hdr}}[$n{$self->{proto}}]}[$i]);
             $self->{optsip}->len($j,
@@ -529,7 +529,7 @@ sub bset {
             @{$self->{optstcp}->type} = ();
             @{$self->{optstcp}->len}  = ();
             @{$self->{optstcp}->data} = ();
-            for (my $i=0; $i<=(@{${$self->{tcphdr}}[18]} - 2); $i = $i + 3) {
+            for (my $i=0; $i<=(@{${$self->{tcphdr}}[18]} - 2); $i += 3) {
                 $self->{optstcp}->type($j,
                     ${${$self->{tcphdr}}[18]}[$i]);
                 $self->{optstcp}->len($j,
diff --git a/test/test-fwknop.pl b/test/test-fwknop.pl
index c3a13104..396c6293 100755
--- a/test/test-fwknop.pl
+++ b/test/test-fwknop.pl
@@ -1154,7 +1154,7 @@ if ($rerun_failed_mode) {
         } elsif ($line =~ /Run time: ([\d\.]+) minutes/) {
             my $total_elapsed_seconds = time() - $start_time;
             my $total_elapsed_minutes = sprintf "%.2f", ($total_elapsed_seconds / 60);
-            $total_elapsed_minutes = $total_elapsed_minutes + $1;
+            $total_elapsed_minutes += $1;
             &logr("    Run time: $total_elapsed_minutes minutes\n");
 
         } elsif ($line =~ /Run time: ([\d\.]+) seconds/) {