aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2020-04-21 17:32:57 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2020-04-21 17:32:57 +0000
commit0c0119856bcaa27c3d2aa5c0c4a1dd614e0a0eac (patch)
tree84bac22c9e4d372b6d010aa4aaf4a5a7a91d2fd7 /libexec
parentd000623a21fa57731f405a985ebb846c26d1c39f (diff)
downloadsrc-0c0119856bcaa27c3d2aa5c0c4a1dd614e0a0eac.tar.gz
src-0c0119856bcaa27c3d2aa5c0c4a1dd614e0a0eac.zip
Notes
Diffstat (limited to 'libexec')
-rw-r--r--libexec/tftpd/tftp-transfer.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/libexec/tftpd/tftp-transfer.c b/libexec/tftpd/tftp-transfer.c
index 67b2289305a0..1d449ea09778 100644
--- a/libexec/tftpd/tftp-transfer.c
+++ b/libexec/tftpd/tftp-transfer.c
@@ -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++;