Skip to content

Commit

Permalink
depmod: Check amount of memories
Browse files Browse the repository at this point in the history
The code does not support 65535 or more modules. Since this value is
probably never reached, add a proper check after array building and
do not rely solely on an assert later in code path.

Signed-off-by: Tobias Stoeckmann <[email protected]>
  • Loading branch information
stoeckmann committed Sep 30, 2024
1 parent 0b18e47 commit a431787
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/depmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,8 @@ static int depmod_modules_build_array(struct depmod *depmod)
if (err < 0)
return err;
}
if (depmod->modules.count >= UINT16_MAX)
return -ERANGE;

return 0;
}
Expand Down

0 comments on commit a431787

Please sign in to comment.