Skip to content

Commit

Permalink
Fix uninitialized vsize variable warning
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Dec 11, 2024
1 parent 7c68a7e commit 091bb12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libr/core/cmd_open.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ static bool cmd_onn(RCore *core, const char* input) {
static int cmd_on(RCore *core, int argc, char *argv[]) {
char *path = NULL;
int fd = -1;
ut64 vsize, vaddr = 0ULL;
ut64 vsize = 0, vaddr = 0ULL;
ut32 i, perm = R_PERM_R;
const ut32 end = R_MIN (argc, 4);
for (i = 0; i < end; i++) {
Expand Down Expand Up @@ -1880,7 +1880,9 @@ static int cmd_on(RCore *core, int argc, char *argv[]) {
}
vsize = r_io_fd_size (core->io, fd);
}
if (!r_io_map_add (core->io, fd, perm, 0ULL, vaddr, vsize)) {
if (vsize == 0) {
R_LOG_WARN ("Map size not defined");
} else if (!r_io_map_add (core->io, fd, perm, 0ULL, vaddr, vsize)) {
R_LOG_WARN ("Couldn't create map");
}
return fd;
Expand Down

0 comments on commit 091bb12

Please sign in to comment.