Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 2020 15:54:05 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r366002 - head/libexec/tftpd
Message-ID:  <202009221554.08MFs5qH009273@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Sep 22 15:54:05 2020
New Revision: 366002
URL: https://svnweb.freebsd.org/changeset/base/366002

Log:
  tftpd: Check for errors from chdir()
  
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/libexec/tftpd/tftpd.c

Modified: head/libexec/tftpd/tftpd.c
==============================================================================
--- head/libexec/tftpd/tftpd.c	Tue Sep 22 15:01:34 2020	(r366001)
+++ head/libexec/tftpd/tftpd.c	Tue Sep 22 15:54:05 2020	(r366002)
@@ -373,7 +373,10 @@ main(int argc, char *argv[])
 			    chroot_dir, strerror(errno));
 			exit(1);
 		}
-		chdir("/");
+		if (chdir("/") != 0) {
+			tftp_log(LOG_ERR, "chdir: %s", strerror(errno));
+			exit(1);
+		}
 		if (setgroups(1, &nobody->pw_gid) != 0) {
 			tftp_log(LOG_ERR, "setgroups failed");
 			exit(1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009221554.08MFs5qH009273>