mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-24 10:09:20 +01:00
Fixed a bug in GetIdbPath() when working in an IDA instance that has dealt with more than one IDB.
idaapi.cvar.database_idb seems to point to a realloc'ed buffer. When IDA is working on an IDB stored in a directory with a long path and a second IDB with a shorter path is loaded, the buffer will be overwritten with the new path to the IDB, which will end in "\x00" and the leftovers of the older, longer path will follow. The problem with GetIdbPath() is that it returns the whole bufer, NULL and "leftovers" included, which leads to trouble in Python. Specifically some functions like os.path.splitext which will look for the extension starting from the end of the buffer and will return an invalid split. The patch simply post-processes the contents of idaapi.cvar.database_idb returning a Python string with all characters up to the "\x00"
This commit is contained in:
parent
80896bc1d9
commit
faf5063818
@ -1635,7 +1635,8 @@ def GetIdbPath():
|
||||
|
||||
This function returns full path of the current IDB database
|
||||
"""
|
||||
return idaapi.cvar.database_idb
|
||||
idb_path = idaapi.cvar.database_idb + '\x00'
|
||||
return idb_path[ : idb_path.find('\x00') ]
|
||||
|
||||
|
||||
def GetInputMD5():
|
||||
|
Loading…
Reference in New Issue
Block a user