debconf: add patches to safeguard Template.pm and Cache.pm

This commit is contained in:
Ark74 2025-08-17 04:55:07 -06:00
parent 745e43935c
commit c058e65f86
3 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,12 @@
diff --git a/Debconf/Template.pm b/Debconf/Template.pm
index 9ab4833d..c3649929 100644
--- a/Debconf/Template.pm
+++ b/Debconf/Template.pm
@@ -140,6 +140,7 @@ Get an existing template (it may be pulled out of the database, etc).
sub get {
my Debconf::Template $this=shift;
my $template=shift;
+ return unless defined $template && length $template;
return $template{$template} if exists $template{$template};
if ($Debconf::Db::templates->exists($template)) {
$this = fields::new($this);

View file

@ -0,0 +1,12 @@
diff --git a/Debconf/DbDriver/Cache.pm b/Debconf/DbDriver/Cache.pm
index 1b0e36fb..2e80d3bb 100644
--- a/Debconf/DbDriver/Cache.pm
+++ b/Debconf/DbDriver/Cache.pm
@@ -122,6 +122,7 @@ undef -- marked as deleted in the cache, so does not exist
sub exists {
my $this=shift;
my $item=shift;
+ return 0 unless defined $item && length $item;
return $this->{cache}->{$item}
if exists $this->{cache}->{$item};