Skip to content

Commit d52d5f0

Browse files
committed
Fixes #4046
1 parent d38acbe commit d52d5f0

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.3.12.24"
21+
VERSION = "1.3.12.25"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/redirecthandler.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import types
1111

1212
from lib.core.common import getHostHeader
13+
from lib.core.common import getSafeExString
1314
from lib.core.common import logHTTPTraffic
1415
from lib.core.common import readInput
1516
from lib.core.convert import getUnicode
@@ -139,6 +140,14 @@ def http_error_302(self, req, fp, code, msg, headers):
139140
except _urllib.error.HTTPError as ex:
140141
result = ex
141142

143+
# Dirty hack for https://github.com/sqlmapproject/sqlmap/issues/4046
144+
try:
145+
hasattr(result, "read")
146+
except KeyError:
147+
class _(object):
148+
pass
149+
result = _()
150+
142151
# Dirty hack for http://bugs.python.org/issue15701
143152
try:
144153
result.info()
@@ -149,7 +158,12 @@ def _(self):
149158

150159
if not hasattr(result, "read"):
151160
def _(self, length=None):
152-
return ex.msg
161+
try:
162+
retVal = getSafeExString(ex)
163+
except:
164+
retVal = ""
165+
finally:
166+
return retVal
153167
result.read = types.MethodType(_, result)
154168

155169
if not getattr(result, "url", None):

0 commit comments

Comments
 (0)