git: 21b5829d28b1 - main - tftpd: Untangle a conditional.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 30 Apr 2024 14:56:30 UTC
The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=21b5829d28b1e02e9f30bfa439238c382dd19114 commit 21b5829d28b1e02e9f30bfa439238c382dd19114 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2024-04-30 14:56:10 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2024-04-30 14:56:17 +0000 tftpd: Untangle a conditional. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45026 --- libexec/tftpd/tftpd.c | 9 +++++---- 1 file 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)