File: 0006-resolve-properly-initialize-result.patch

package info (click to toggle)
ferm 2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,140 kB
  • sloc: perl: 2,839; sh: 126; makefile: 120
file content (32 lines) | stat: -rw-r--r-- 928 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From: Marc Haber <mh+debian-packages@zugschlus.de>
Date: Sun, 1 Jun 2025 16:01:23 +0200
Subject: resolve: properly initialize @result

Forwarded: https://github.com/MaxKellermann/ferm/issues/105
---
 src/ferm | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/ferm b/src/ferm
index dc29ef0..72f0bf4 100755
--- a/src/ferm
+++ b/src/ferm
@@ -1320,7 +1320,7 @@ sub resolve($@) {
     $type = ($domain eq 'ip6') ? 'AAAA' : 'A'
         unless $type;
 
-    my @result;
+    my @result = ();
     foreach my $hostname (@names) {
         my $numeric_type = identify_numeric_address($hostname);
         if (defined $numeric_type) {
@@ -1360,9 +1360,6 @@ sub resolve($@) {
     @result = resolve($domain, \@result, undef)
       if $type eq 'NS' or $type eq 'MX';
 
-    # if there are no records, return an empty array instead of "undefined"
-    return [] unless length @result;
-
     return @result;
 }