https://bugs.gentoo.org/976110 https://www.openwall.com/lists/oss-security/2026/05/27/5 From: Stig Palmquist --- a/lib/HTTP/Daemon.pm +++ b/lib/HTTP/Daemon.pm @@ -598,11 +598,10 @@ sub send_dir { sub send_file { my ($self, $file) = @_; my $opened = 0; - local (*FILE); if (!ref($file)) { - open(FILE, $file) || return undef; - binmode(FILE); - $file = \*FILE; + open(my $fh, '<', $file) || return undef; + binmode($fh) || do { close($fh); return undef }; + $file = $fh; $opened++; } my $cnt = 0; @@ -614,7 +613,11 @@ sub send_file { print $self $buf; } close($file) if $opened; - $cnt; + + # Return a "true zero" for empty-but-successful copies so callers + # using `send_file or die` can distinguish open failure (undef) + # from a successful zero-byte transfer. + $cnt || '0E0'; }