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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to