mirror of
https://github.com/openbsd/src.git
synced 2026-05-01 17:46:35 +00:00
when processing readdir(), this incorrectly did fstatat() against "..".
observed during experimental work with O_BELOW ok millert, who may want to refactor this further.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: at.c,v 1.85 2024/11/05 16:26:01 sobrado Exp $ */
|
||||
/* $OpenBSD: at.c,v 1.86 2025/05/31 14:21:07 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* at.c : Put file into atrun queue
|
||||
@@ -495,6 +495,8 @@ list_jobs(int argc, char **argv, int count_only, int csort)
|
||||
|
||||
/* Loop over every file in the directory. */
|
||||
while ((dirent = readdir(spool)) != NULL) {
|
||||
if (strcmp(dirent->d_name, "..") == 0)
|
||||
continue;
|
||||
if (fstatat(dfd, dirent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
|
||||
fatal("%s", dirent->d_name);
|
||||
|
||||
@@ -653,6 +655,8 @@ process_jobs(int argc, char **argv, int what)
|
||||
/* Loop over every file in the directory */
|
||||
changed = 0;
|
||||
while ((dirent = readdir(spool)) != NULL) {
|
||||
if (strcmp(dirent->d_name, "..") == 0)
|
||||
continue;
|
||||
if (fstatat(dfd, dirent->d_name, &stbuf, AT_SYMLINK_NOFOLLOW) != 0)
|
||||
fatal("%s", dirent->d_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user