[LTP] [PATCH v4] tst_tmpdir: Fix buffer overflow in tst_tmpdir.c
Cyril Hrubis
chrubis@suse.cz
Wed Feb 25 11:58:53 CET 2026
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
More information about the ltp
mailing list