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

Skip to content

Commit 2f74413

Browse files
committed
Patch for an Issue #968
1 parent 2284535 commit 2f74413

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@ def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, un
19301930
retVal[line] = True
19311931
else:
19321932
retVal.append(line)
1933-
except (IOError, OSError), ex:
1933+
except (IOError, OSError, MemoryError), ex:
19341934
errMsg = "something went wrong while trying "
19351935
errMsg += "to read the content of file '%s' ('%s')" % (filename, ex)
19361936
raise SqlmapSystemException(errMsg)

lib/core/option.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
from lib.core.exception import SqlmapMissingPrivileges
9191
from lib.core.exception import SqlmapSilentQuitException
9292
from lib.core.exception import SqlmapSyntaxException
93+
from lib.core.exception import SqlmapSystemException
9394
from lib.core.exception import SqlmapUnsupportedDBMSException
9495
from lib.core.exception import SqlmapUserQuitException
9596
from lib.core.log import FORMATTER
@@ -361,9 +362,14 @@ def _parseBurpLog(content):
361362
kb.targets.add((url, method, data, cookie, tuple(headers)))
362363
addedTargetUrls.add(url)
363364

364-
fp = openFile(reqFile, "rb")
365-
366-
content = fp.read()
365+
checkFile(reqFile)
366+
try:
367+
with openFile(reqFile, "rb") as f:
368+
content = f.read()
369+
except (IOError, OSError, MemoryError), ex:
370+
errMsg = "something went wrong while trying "
371+
errMsg += "to read the content of file '%s' ('%s')" % (reqFile, ex)
372+
raise SqlmapSystemException(errMsg)
367373

368374
if conf.scope:
369375
logger.info("using regular expression '%s' for filtering targets" % conf.scope)

0 commit comments

Comments
 (0)