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"
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"
trietptm/idapython,kamilkk/idapython,roymuste/idapython,trietptm/idapython,rigmar/idapython,rigmar/idapython,Alwnikrotikz/idapython,kamilkk/idapython,Alwnikrotikz/idapython,roymuste/idapython,roymuste/idapython,Alwnikrotikz/idapython,trietptm/idapython,rigmar/idapython,kamilkk/idapython