Skip to content

Commit 19371af

Browse files
authored
Merge pull request #15 from QuantumPL/fix-path-traversal-vulnerability-13463926459918946299
🔒 Fix path traversal vulnerability in bibtex-compatibility.py
2 parents c082ae6 + e3778b7 commit 19371af

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bibtex-compatibility.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Original source: https://github.com/jonsterling/bibtex-references
33
# Modified by Kartik for use in qpl-bib
44

5+
import os
56
import re
67
import sys
78

@@ -20,7 +21,11 @@
2021
12: "dec"
2122
}
2223

23-
db_name = sys.argv[1]
24+
if len(sys.argv) < 2:
25+
print("Usage: python3 bibtex-compatibility.py <db_name>")
26+
sys.exit(1)
27+
28+
db_name = os.path.basename(sys.argv[1])
2429

2530
old_db = open(db_name + ".bib","r")
2631
new_db = open("bibtex.bib","w")

0 commit comments

Comments
 (0)