Skip to content

Commit

Permalink
bug fix in install.c: heap buffer overflow on realloc
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro-Salerno committed Nov 8, 2024
1 parent 3cda3bc commit 5c1e0dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/cli/directives/commands/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ static bool infer_app_name(rt_recipe_t *recipe, const char *pkg_path) {

if (names_buf_sz - 1 == count) {
names_buf_sz *= 2;
names = (char **)realloc(names, names_buf_sz);
names = (char **)realloc(names, names_buf_sz * sizeof(char *));
mem_chkoom(names);
}

Expand Down Expand Up @@ -485,7 +485,7 @@ static bool find_executables(char ***execs,
else if (TM_FS_FILETYPE_EXEC == ent.file_type) {
if (*bufsz - 1 == *count) {
*bufsz *= 2;
*execs = (char **)realloc(*execs, *bufsz);
*execs = (char **)realloc(*execs, *bufsz * sizeof(char *));
mem_chkoom(*execs);
}

Expand Down

0 comments on commit 5c1e0dd

Please sign in to comment.