Re: [LTP] [PATCH v4] tst_tmpdir: Fix buffer overflow in tst_tmpdir.c

Cyril Hrubis
2026-02-25T10:59:08Z

Hi!
> @@ -183,8 +186,7 @@ static int purge_dir(const char *path, char **errptr)
> continue;
>
> /* Recursively remove the current entry */
> - sprintf(dirobj, "%s/%s", path, dir_ent->d_name);
> - if (rmobj(dirobj, errptr) != 0)
> + if (rmobjat(subdir_fd, dir_ent->d_name, errptr) != 0)
> ret_val = -1;
> }

Shouldn't we close(subdir_fd) here as well?

> @@ -192,63 +194,53 @@ static int purge_dir(const char *path, char **errptr)
> return ret_val;
> }
>

The rest seems to be fine.

--
Cyril Hrubis
chrubis@suse.cz