Skip to content

Commit

Permalink
tftpd: Untangle a conditional.
Browse files Browse the repository at this point in the history
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45026
  • Loading branch information
dag-erling committed Apr 30, 2024
1 parent 661a83f commit 21b5829
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libexec/tftpd/tftpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 21b5829

Please sign in to comment.