Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 673347 Details for
Bug 892299
CVE-2013-0159 predictable file name used in /tmp to generate pdf output [fedora-all]
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
use a proper temporary random filename, and clean file after
0001-do-not-use-a-fixed-predictible-filename-in-tmp-and-r.patch (text/plain), 3.62 KB, created by
Michael S.
on 2013-01-06 12:56:14 UTC
(
hide
)
Description:
use a proper temporary random filename, and clean file after
Filename:
MIME Type:
Creator:
Michael S.
Created:
2013-01-06 12:56:14 UTC
Size:
3.62 KB
patch
obsolete
>From 6d748c053f979f505e00a7af93dfbf19782863e3 Mon Sep 17 00:00:00 2001 >From: Michael Scherer <misc@zarb.org> >Date: Sun, 6 Jan 2013 13:34:16 +0100 >Subject: [PATCH] do not use a fixed predictible filename in /tmp, and remove > the temporary file once not used anymore > >--- > fedora_business_cards/export.py | 42 +++++++++++++++++++++++------------------ > 1 file changed, 24 insertions(+), 18 deletions(-) > >diff --git a/fedora_business_cards/export.py b/fedora_business_cards/export.py >index 46f0c0f..78e828d 100644 >--- a/fedora_business_cards/export.py >+++ b/fedora_business_cards/export.py >@@ -25,6 +25,7 @@ Functions to export cards from SVGs. > import subprocess > import math > import os >+import tempfile > > from fedora_business_cards.common import convert > >@@ -42,14 +43,15 @@ def run_command(args, stdin=None): > return proc.communicate() > > >-def svg_to_file(xmlstring, filename): >+def svg_to_file(xmlstring): > """ > Write an SVG to a file. > """ >- handle = file(filename, 'w') >+ fd, svgfilename = tempfile.mkstemp("fedora-business-cards-buffer.svg") >+ handle = os.fdopen(fd,'w') > handle.write(xmlstring.encode('utf-8')) > handle.close() >- return True >+ return svgfilename > > > def svg_to_pdf_png(xmlstring, filename, output_format='png', dpi=300): >@@ -60,20 +62,24 @@ def svg_to_pdf_png(xmlstring, filename, output_format='png', dpi=300): > output_format = either 'png', 'pdf', or 'eps' > dpi = DPI to export PNG with (default: 300) > """ >- svgfilename = "/tmp/fedora-business-cards-buffer.svg" >+ svgfilename = svg_to_file(xmlstring) > filename = os.path.join(os.getenv("PWD"), filename) >- svg_to_file(xmlstring, svgfilename) >- if output_format == 'png': >- run_command(['inkscape', '-C', '-z', '-d', str(dpi), '-e', filename, >- svgfilename]) >- elif output_format == 'pdf': >- run_command(['inkscape', '-C', '-z', '-T', '-A', filename, >- svgfilename]) >- elif output_format == 'eps': >- run_command(['inkscape', '-C', '-z', '-T', '-E', filename, >- svgfilename]) >- else: >- raise Exception("Invalid file format requested") >+ try: >+ if output_format == 'png': >+ run_command(['inkscape', '-C', '-z', '-d', str(dpi), '-e', filename, >+ svgfilename]) >+ elif output_format == 'pdf': >+ run_command(['inkscape', '-C', '-z', '-T', '-A', filename, >+ svgfilename]) >+ elif output_format == 'eps': >+ run_command(['inkscape', '-C', '-z', '-T', '-E', filename, >+ svgfilename]) >+ else: >+ os.remove(svgfilename) >+ raise Exception("Invalid file format requested") >+ finally: >+ os.remove(svgfilename) >+ > return True > > >@@ -87,9 +93,8 @@ def svg_to_cmyk_pdf(xmlstring, filename, user_height, user_width, user_bleed, > converter = a tuple of tuples to convert from RGB to CMYK colors. see > generators.fedora.rgb_to_cmyk for an example > """ >- svgfilename = "/tmp/fedora-business-cards-buffer.svg" > filename = os.path.join(os.getenv("PWD"), filename) >- svg_to_file(xmlstring, svgfilename) >+ svgfilename = svg_to_file(xmlstring) > args = ['inkscape', '-C', '-z', '-T', '-E', '/dev/stdout', svgfilename] > eps = run_command(args)[0] > if converter: >@@ -102,6 +107,7 @@ def svg_to_cmyk_pdf(xmlstring, filename, user_height, user_width, user_bleed, > '-r%s' % dpi, '-g%sx%s' % (width, height), > '-sOutputFile=%s' % filename, '-', '-c', 'quit'] > run_command(args, eps) >+ os.remove(svgfilename) > return True > > >-- >1.8.0.2 >
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 892299
: 673347