Fix assert in RSign.loadGZ() when file not found in path

This commit is contained in:
pancake 2023-03-06 16:52:10 +01:00
parent d1e1ef6159
commit 727bc9cd2c
2 changed files with 7 additions and 1 deletions

View File

@ -2941,6 +2941,10 @@ R_API bool r_sign_load_gz(RAnal *a, const char *filename, bool merge) {
char *tmpfile = NULL;
bool retval = true;
char *path = r_sign_path (a, filename);
if (!path) {
R_LOG_ERROR ("file %s not found in sign path", filename);
return false;
}
if (!r_file_exists (path)) {
R_LOG_ERROR ("file %s does not exist", filename);
retval = false;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2007-2022 - pancake */
/* radare - LGPL - Copyright 2007-2023 - pancake */
#define R_LOG_ORIGIN "filter"
@ -181,6 +181,7 @@ R_API bool r_file_is_directory(const char *str) {
}
R_API bool r_file_fexists(const char *fmt, ...) {
r_return_val_if_fail (fmt, false);
int ret;
char string[BS];
va_list ap;
@ -192,6 +193,7 @@ R_API bool r_file_fexists(const char *fmt, ...) {
}
R_API bool r_file_exists(const char *str) {
r_return_val_if_fail (str, false);
struct stat buf = {0};
#if 1
if (file_stat (str, &buf) != 0) {