Subject: | Unitialized string in X11::Auth |
In X11::Auth, method get_by_host, line 97:
my($addr);
$addr = gethostbyname($host) if $fam eq "Internet";
#print "host $host, addr $addr\n";
my($d);
for $d ($self->get_all) {
next unless $dpy eq $d->[2];
next unless $fam eq $d->[0] or ($fam eq "Internet"
and $d->[0] eq "Local");
if ($fam eq "Internet" or $fam eq "Local") {
Show quoted text
>>>>> if ($d->[1] eq $addr or $d->[1] eq $host) {
return ($d->[3], $d->[4]);
}
}
}
The problem is that $addr will not be initialized if $fam is NOT "Internet", causing a "Use of uninitialized value in string eq" error to be printed.
I fixed this by changing line 97 to:
if ((defined $addr && $d->[1] eq $addr) or $d->[1] eq $host) {
but perhaps $addr should be given a default value instead?
-David Edelstein