1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-22 15:47:37 +00:00

tftpd: Untangle a conditional.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45026
This commit is contained in:
Dag-Erling Smørgrav 2024-04-30 16:56:10 +02:00
parent 661a83f9bf
commit 21b5829d28

View File

@ -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)