Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e4b00bd

Browse files
committed
Patch for an Issue #983
1 parent 2358e34 commit e4b00bd

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

lib/core/common.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from subprocess import Popen as execute
4141
from xml.dom import minidom
4242
from xml.sax import parse
43+
from xml.sax import SAXParseException
4344

4445
from extra.cloak.cloak import decloak
4546
from extra.safe2bin.safe2bin import safecharencode
@@ -77,6 +78,7 @@
7778
from lib.core.exception import SqlmapDataException
7879
from lib.core.exception import SqlmapGenericException
7980
from lib.core.exception import SqlmapNoneDataException
81+
from lib.core.exception import SqlmapInstallationException
8082
from lib.core.exception import SqlmapMissingDependence
8183
from lib.core.exception import SqlmapSilentQuitException
8284
from lib.core.exception import SqlmapSyntaxException
@@ -1758,8 +1760,14 @@ def parseXmlFile(xmlFile, handler):
17581760
Parses XML file by a given handler
17591761
"""
17601762

1761-
with contextlib.closing(StringIO(readCachedFileContent(xmlFile))) as stream:
1762-
parse(stream, handler)
1763+
try:
1764+
with contextlib.closing(StringIO(readCachedFileContent(xmlFile))) as stream:
1765+
parse(stream, handler)
1766+
except (SAXParseException, UnicodeError), ex:
1767+
errMsg = "something seems to be wrong with "
1768+
errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, ex)
1769+
errMsg += "sure that you haven't made any changes to it"
1770+
raise SqlmapInstallationException, errMsg
17631771

17641772
def getSQLSnippet(dbms, sfile, **variables):
17651773
"""

0 commit comments

Comments
 (0)