Fix oobread in load_zign ##shell

This commit is contained in:
pancake 2023-03-06 17:48:37 +01:00
parent 727bc9cd2c
commit d054fd1312
2 changed files with 6 additions and 4 deletions

View File

@ -2913,10 +2913,12 @@ R_API char *r_sign_path(RAnal *a, const char *file) {
}
R_API bool r_sign_load(RAnal *a, const char *file, bool merge) {
if (!a || !file) {
r_return_val_if_fail (a && file, false);
char *path = r_sign_path (a, file);
if (!path) {
R_LOG_ERROR ("file %s not found in sign path", file);
return false;
}
char *path = r_sign_path (a, file);
if (!r_file_exists (path)) {
R_LOG_ERROR ("file %s does not exist", file);
free (path);

View File

@ -291,13 +291,13 @@ static int cmdOpen(void *data, const char *input) {
switch (*input) {
case ' ':
if (input[1]) {
return r_sign_load (core->anal, input + 1, false);
return r_sign_load (core->anal, r_str_trim_head_ro (input + 1), false);
}
r_core_cmd_help_match (core, help_msg_zo, "zo", false);
return false;
case 's':
if (input[1] == ' ' && input[2]) {
return r_sign_save (core->anal, input + 2);
return r_sign_save (core->anal, r_str_trim_head_ro (input + 2));
}
r_core_cmd_help_match (core, help_msg_zo, "zos", false);
return false;