aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2024-04-30 14:56:10 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2024-04-30 14:56:17 +0000
commit21b5829d28b1e02e9f30bfa439238c382dd19114 (patch)
tree10fc48fbefd1055aaf01f604c1a7b9959a3dd2de /libexec
parent661a83f9bf9f6028c5617d413d59b7f0d9201abd (diff)
downloadsrc-21b5829d28b1e02e9f30bfa439238c382dd19114.tar.gz
src-21b5829d28b1e02e9f30bfa439238c382dd19114.zip
tftpd: Untangle a conditional.
MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45026
Diffstat (limited to 'libexec')
-rw-r--r--libexec/tftpd/tftpd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 13f53024b147..c832097e0ba0 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -687,10 +687,11 @@ validate_access(int peer, char **filep, int mode)
* it's a /.
*/
for (dirp = dirs; dirp->name != NULL; dirp++) {
- if (dirp->len == 1 ||
- (!strncmp(filename, dirp->name, dirp->len) &&
- filename[dirp->len] == '/'))
- break;
+ if (dirp->len == 1)
+ break;
+ if (strncmp(filename, dirp->name, dirp->len) == 0 &&
+ filename[dirp->len] == '/')
+ break;
}
/* If directory list is empty, allow access to any file */
if (dirp->name == NULL && dirp != dirs)