From f1da168cb702485ec5ba40e1c1d335bcbbf90a91 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 23 Jul 2008 23:46:15 +0000 Subject: [PATCH] -Fix potential for uninitialized values in xcatd in certain places git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1944 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 2da201c18..55443ac51 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -934,12 +934,15 @@ sub thishostisnot { my $cmd = ($^O !~ /^aix/i) ? "/sbin/ip addr" : "ifconfig -a"; my @ips = split /\n/,`$cmd`; my $comp=inet_aton($comparison); + unless ($comp) { + return 1; + } foreach (@ips) { if (/^\s*inet/) { my @ents = split(/\s+/); my $ip=$ents[2]; $ip =~ s/\/.*//; - if (inet_aton($ip) eq $comp) { + if (inet_aton($ip) and inet_aton($ip) eq $comp) { return 0; } #print Dumper(inet_aton($ip)); @@ -1196,7 +1199,7 @@ sub validate { foreach $rule (@policies) { if ($rule->{name} and $rule->{name} ne '*') { #TODO: more complex matching (lists, wildcards) - next unless ($peername eq $rule->{name}); + next unless ($peername and $peername eq $rule->{name}); } if ($rule->{time} and $rule->{time} ne '*') { #TODO: time ranges