Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2023 13:29:15 GMT
From:      =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a6dfd2015c20 - main - tftpd: Fix max block size calculation.
Message-ID:  <202303101329.32ADTFRj089975@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=a6dfd2015c202f3424eb58846d8575a877728881

commit a6dfd2015c202f3424eb58846d8575a877728881
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2023-03-10 13:24:15 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-03-10 13:25:15 +0000

    tftpd: Fix max block size calculation.
    
    Sponsored by:   Klara, Inc.
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D38953
---
 libexec/tftpd/tftp-options.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libexec/tftpd/tftp-options.c b/libexec/tftpd/tftp-options.c
index 01876b4750f9..037517f9cd73 100644
--- a/libexec/tftpd/tftp-options.c
+++ b/libexec/tftpd/tftp-options.c
@@ -230,6 +230,7 @@ option_blksize(int peer)
 		tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram");
 		return (acting_as_client ? 1 : 0);
 	}
+	maxdgram -= 4; /* leave room for header */
 
 	int size = atoi(options[OPT_BLKSIZE].o_request);
 	if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202303101329.32ADTFRj089975>