[PATCH] dpkg-buildpackage: Avoid using uninitialized variable

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] dpkg-buildpackage: Avoid using uninitialized variable

Sven Joachim
If DEB_SIGN_KEYID is not set in the environment, dpkg-buildpackage
would complain:

Use of uninitialized value $signkey in pattern match (m//) at /usr/bin/dpkg-buildpackage line 817.

Fixes: commit 6f903af181057a046a1344aadca552b113a2c2ee
---
 scripts/dpkg-buildpackage.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index dccb8f87e..291160592 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -814,7 +814,7 @@ sub update_files_field {
 
 sub signkey_validate {
     # Make sure this is an hex keyid.
-    return unless $signkey =~ m/^(?:0x)?([[:xdigit:]]+)$/;
+    return unless (defined $signkey && $signkey =~ m/^(?:0x)?([[:xdigit:]]+)$/);
 
     my $keyid = $1;
 
--
2.17.0