FreeBSD Bugzilla – Attachment 215143 Details for
Bug 246919
misc/mime-support: run-mailcap TempFile infinite loop
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
patch for port misc/mime-support to improve tempfile name generation
patch-3.63-run-mailcap-tempfile.txt (text/plain), 1.35 KB, created by
G. Paul Ziemba
on 2020-06-01 20:09:35 UTC
(
hide
)
Description:
patch for port misc/mime-support to improve tempfile name generation
Filename:
MIME Type:
Creator:
G. Paul Ziemba
Created:
2020-06-01 20:09:35 UTC
Size:
1.35 KB
patch
obsolete
>--- run-mailcap.orig 2020-04-26 01:35:54.000000000 -0700 >+++ run-mailcap 2020-06-01 12:10:54.636874000 -0700 >@@ -12,6 +12,7 @@ > use Encode qw(decode); > use I18N::Langinfo qw(langinfo CODESET); > use File::Spec; >+use File::Temp qw(tempfile); > > $debug=($ENV{RUN_MAILCAP_DEBUG} || 0); > $norun=0; >@@ -138,22 +139,13 @@ > > ($head,$tail) = split(/%s/,$template,2); > >-# $tmpfile = POSIX::tmpnam($name); >-# unlink($tmpfile); >+ my($fh, $filename) = tempfile( >+ TEMPLATE => $head . 'XXXXX', >+ SUFFIX => $tail, >+ ); > >- $cmd = "tempfile --mode=600"; >- $cmd .= " --prefix $head" if $head; >- $cmd .= " --suffix $tail" if $tail; >- >- $tmpfile = `$cmd`; >- chomp($tmpfile); >- >-# $tmpfile = $ENV{TMPDIR}; >-# $tmpfile = "/tmp" unless $tmpfile; >-# $tmpfile.= "/$name"; >-# unlink($tmpfile); >- >- return $tmpfile; >+ chmod(0600, $fh); >+ return $filename; > } > > >@@ -481,8 +473,14 @@ > $match =~ m/nametemplate=(.*?)\s*($|;)/; > my $prefix = $1; > my $linked = 0; >+ my $iterations = 0; > while (!$linked) { > $tmplink = TempFile($prefix); >+ >+ if (++$iterations > 50) { >+ die "looped too many times trying to make temp file"; >+ } >+ # race: > unlink($tmplink); > $linked = symlink($file,$tmplink); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 246919
: 215143