pkgsrc/chat/gajim/patches/patch-src_common_latex.py
gls 4a5060b5d0 Update chat/gajim to 0.15.
pkgsrc changes:
---------------
- Add a patch to fix CVE-2012-2093, taken from upstream repository.
- s/py-amkCrypto/py-crypto (py-amkCrypto is not maintained anymore upstream)

upstream changes:
-----------------

Gajim 0.15 (18 March 2012)

* Plugin system
* Whiteboard (via a plugin)
* Message archiving
* Stream managment
* IBB
* Nested roster group
* Roster filtrering
* UPower support
* GPG support for windows
* Spell checking support for windows

Gajim 0.14.4 (22 July 2011)

* Fix translation issue
* other minor fixes

Gajim 0.14.3 (19 June 2011)

* Fix history viewer
* Fix closing roster window
* Prevent some erros with metacontacts

Gajim 0.14.2 (07 June 2011)

* Fix CPU usage when testing file transfer proxies
* Fix invalid XML char regex
* Fix subscription request window handling
* Fix URL display in chat message banner
* Other minor bugfixes
2012-04-17 20:57:09 +00:00

29 lines
1.1 KiB
Python

$NetBSD: patch-src_common_latex.py,v 1.1 2012/04/17 20:57:09 gls Exp $
CVE-2012-2093: improve temp file search when using latex to prevent overwriting files
Taken from upstream repository: https://trac.gajim.org/changeset/13759/src/common/latex.py
--- src/common/latex.py.orig 2012-03-18 11:25:56.000000000 +0000
+++ src/common/latex.py
@@ -59,8 +59,19 @@ def check_blacklist(str_):
def get_tmpfile_name():
random.seed()
- int_ = random.randint(0, 100)
- return os.path.join(gettempdir(), 'gajimtex_' + int_.__str__())
+ while(nb < 100):
+ int_ = random.randint(0, 10000)
+ filename = os.path.join(gettempdir(), 'gajimtex_' + int_.__str__())
+ # Check if a file to not overwrite it
+ ok = True
+ extensions = ['.tex', '.log', '.aux', '.dvi']
+ for ext in extensions:
+ if os.path.exists(filename + ext):
+ ok = False
+ break
+ if ok:
+ return filename
+ return filename
def write_latex(filename, str_):
texstr = '\\documentclass[12pt]{article}\\usepackage[dvips]{graphicx}'