Skip to content

Commit

Permalink
validate_xdg_dir_absolute() allocates a byte short when building the …
Browse files Browse the repository at this point in the history
…string buffer in one of the code-paths.
  • Loading branch information
mywave82 committed Apr 1, 2024
1 parent e4b6206 commit d1fc8df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions boot/kickload-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static char *validate_xdg_dir_absolute (const char *name, const char *def)
}
if (xdg)
{
char *retval = malloc (strlen (xdg) + 5);
char *retval = malloc (strlen (xdg) + 5 + 1);
if (retval)
{
sprintf (retval, "%s%socp/",
Expand Down Expand Up @@ -783,7 +783,7 @@ int validate_home(void)
char settingsPath[PATH_MAX];
if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, settingsPath, sizeof(settingsPath)) == B_OK)
{
_cfConfigHomeDir = malloc (strlen (settingsPath) + 5);
_cfConfigHomeDir = malloc (strlen (settingsPath) + 5 + 1);
if (!_cfConfigHomeDir)
{
fprintf (stderr, "malloc() failed\n");
Expand Down

0 comments on commit d1fc8df

Please sign in to comment.