Skip to content

Commit 735b0df

Browse files
committed
fix: make sure only positive integers can be used for full-inventory-postpone option
1 parent 3b48b14 commit 735b0df

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Diff for: lib/GLPI/Agent/Inventory.pm

+2-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ sub computeChecksum {
508508

509509
# Prepare to postpone full inventory when required
510510
my $postpone = 0;
511-
$postpone = (($last_state->get('_postpone_count') // 0) + 1) % ($postpone_config+1)
511+
my $current_count = $last_state->get('_postpone_count') // '0';
512+
$postpone = ($current_count =~ /^\d+$/ ? int($current_count)+1 : 1) % ($postpone_config+1)
512513
if $postpone_config;
513514

514515
# Always disable postpone if format is not json

Diff for: lib/GLPI/Agent/Task/Inventory.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ sub _feedInventory {
564564
if $versionprovider;
565565

566566
# Don't compute checksum on partial inventory or with glpi-inventory script
567-
$self->{inventory}->computeChecksum($self->{config}->{'full-inventory-postpone'})
567+
$self->{inventory}->computeChecksum($self->{config}->{'full-inventory-postpone'} =~ /^\d+$/ ? int($self->{config}->{'full-inventory-postpone'}) : 0)
568568
unless $self->{partial} || $self->{nochecksum};
569569
}
570570

0 commit comments

Comments
 (0)