From 2d294ae8f781bb0eafaff5e927f522c0b20dc983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Tue, 21 Jul 2026 14:59:01 -0300 Subject: [PATCH] fix(NetworkUtils): guard formatNetmask against an undefined mask formatNetmask() uses its first argument immediately (inet_aton($mask), 2**$mask, hex $mask) with no check that it is defined. Callers that pass an undefined mask trigger "Use of uninitialized value" warnings and a meaningless result instead of a clean failure. Return undef up front when $mask is not defined. Recovered from the unmerged lenovobuild branch (original acbbeb86). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- perl-xCAT/xCAT/NetworkUtils.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 9a0fbef1d..89a293472 100644 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -1389,6 +1389,7 @@ sub formatNetmask my $origType = shift; my $newType = shift; my $maskn; + if (not defined $mask) { return undef; } if ($origType == 0) { $maskn = unpack("N", inet_aton($mask));