tftpd: chroot to DIR, not merely chdir. Closes 4874

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2012-03-08 00:28:52 +01:00
parent 0687a5b496
commit 4e3beb2e1d

View File

@ -789,8 +789,9 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
openlog(applet_name, LOG_PID, LOG_DAEMON); openlog(applet_name, LOG_PID, LOG_DAEMON);
logmode = LOGMODE_SYSLOG; logmode = LOGMODE_SYSLOG;
} }
if (argv[0]) if (argv[0]) {
xchdir(argv[0]); xchroot(argv[0]);
}
result = recv_from_to(STDIN_FILENO, block_buf, sizeof(block_buf), result = recv_from_to(STDIN_FILENO, block_buf, sizeof(block_buf),
0 /* flags */, 0 /* flags */,