From 48301d970394126534fc2b25cf7f70d166898c1c Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Tue, 27 Jan 2009 17:52:36 +0000 Subject: [PATCH] python.cpp: Added error handling to return_python_result() python.cpp: Added plugin arguments to enable/disable exlang_python python.cpp: Patch by Igor Skochinsky --- python.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/python.cpp b/python.cpp index b55b020..3182f2d 100644 --- a/python.cpp +++ b/python.cpp @@ -290,6 +290,9 @@ static bool return_python_result(idc_value_t *rv, char *errbuf, size_t errbufsize) { + if (errbufsize > 0) + errbuf[0] = '\0'; + if (result == NULL) { handle_python_error(errbuf, errbufsize); @@ -326,6 +329,7 @@ static bool return_python_result(idc_value_t *rv, return true; } + qsnprintf(errbuf, errbufsize, "ERROR: bad return value"); return false; } @@ -706,6 +710,14 @@ void idaapi run(int arg) IDAPython_ScriptBox(); break; ;; + case 3: + enable_extlang_python(true); + break; + ;; + case 4: + enable_extlang_python(false); + break; + ;; default: warning("IDAPython: unknown plugin argument %d", arg); break;