Date: Tue, 21 Apr 2020 17:32:58 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360167 - head/libexec/tftpd Message-ID: <202004211732.03LHWw4O012765@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Tue Apr 21 17:32:57 2020 New Revision: 360167 URL: https://svnweb.freebsd.org/changeset/base/360167 Log: Abort transfer if fseeko() fails. CID: 1420215 Reviewed by: asomers MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24454 Modified: head/libexec/tftpd/tftp-transfer.c Modified: head/libexec/tftpd/tftp-transfer.c ============================================================================== --- head/libexec/tftpd/tftp-transfer.c Tue Apr 21 17:30:56 2020 (r360166) +++ head/libexec/tftpd/tftp-transfer.c Tue Apr 21 17:32:57 2020 (r360167) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <syslog.h> #include "tftp-file.h" @@ -124,7 +125,13 @@ read_block: acktry++; ts->retries++; - seek_file(window[0].offset); + if (seek_file(window[0].offset) != 0) { + tftp_log(LOG_ERR, + "seek_file failed: %s", + strerror(errno)); + send_error(peer, errno + 100); + goto abort; + } *block = window[0].block; windowblock = 0; goto read_block; @@ -158,7 +165,13 @@ read_block: /* Resend the current window. */ ts->retries++; - seek_file(window[0].offset); + if (seek_file(window[0].offset) != 0) { + tftp_log(LOG_ERR, + "seek_file failed: %s", + strerror(errno)); + send_error(peer, errno + 100); + goto abort; + } *block = window[0].block; windowblock = 0; goto read_block; @@ -183,7 +196,14 @@ read_block: if (debug&DEBUG_SIMPLE) tftp_log(LOG_DEBUG, "Partial ACK"); - seek_file(window[i + 1].offset); + if (seek_file(window[i + 1].offset) != + 0) { + tftp_log(LOG_ERR, + "seek_file failed: %s", + strerror(errno)); + send_error(peer, errno + 100); + goto abort; + } *block = window[i + 1].block; windowblock = 0; ts->retries++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004211732.03LHWw4O012765>