Fix null deref in QJS plugin handling

This commit is contained in:
pancake 2023-12-06 18:00:26 +01:00
parent 5709416ea5
commit 702cbbef4d
2 changed files with 5 additions and 2 deletions

View File

@ -63,8 +63,8 @@ static int on_fcn_rename(RAnal *_anal, void* _user, RAnalFunction *fcn, const ch
static void r_core_debug_breakpoint_hit(RCore *core, RBreakpointItem *bpi) { static void r_core_debug_breakpoint_hit(RCore *core, RBreakpointItem *bpi) {
const char *cmdbp = r_config_get (core->config, "cmd.bp"); const char *cmdbp = r_config_get (core->config, "cmd.bp");
const bool cmdbp_exists = (cmdbp && *cmdbp); const bool cmdbp_exists = R_STR_ISNOTEMPTY (cmdbp);
const bool bpcmd_exists = (bpi->data && bpi->data[0]); const bool bpcmd_exists = R_STR_ISNOTEMPTY (bpi->data);
const bool may_output = (cmdbp_exists || bpcmd_exists); const bool may_output = (cmdbp_exists || bpcmd_exists);
if (may_output) { if (may_output) {
r_cons_push (); r_cons_push ();

View File

@ -61,6 +61,9 @@
static int r_cmd_qjs_call(void *c, const char *input) { static int r_cmd_qjs_call(void *c, const char *input) {
RCore *core = c; RCore *core = c;
QjsPluginManager *pm = R_UNWRAP4 (core, lang, session, plugin_data); QjsPluginManager *pm = R_UNWRAP4 (core, lang, session, plugin_data);
if (pm == NULL) {
return false;
}
// Iterate over plugins until one returns "true" (meaning the plugin handled the input) // Iterate over plugins until one returns "true" (meaning the plugin handled the input)
QjsCorePlugin *plugin; QjsCorePlugin *plugin;