From 4e3beb2e1db3d4739a5a924e003938a9815f98e5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 8 Mar 2012 00:28:52 +0100 Subject: [PATCH] tftpd: chroot to DIR, not merely chdir. Closes 4874 Signed-off-by: Denys Vlasenko --- networking/tftp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/networking/tftp.c b/networking/tftp.c index 043b879af..ce48a1edd 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -789,8 +789,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) openlog(applet_name, LOG_PID, LOG_DAEMON); logmode = LOGMODE_SYSLOG; } - if (argv[0]) - xchdir(argv[0]); + if (argv[0]) { + xchroot(argv[0]); + } result = recv_from_to(STDIN_FILENO, block_buf, sizeof(block_buf), 0 /* flags */,