From: Ravik Hasija <rahasij@linux.microsoft.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4] net: tftp: Add client support for RFC 7440
Date: Tue, 2 Jun 2020 19:54:46 -0700 (MST) [thread overview]
Message-ID: <1591152886830-0.post@n7.nabble.com> (raw)
In-Reply-To: <20200519192557.18075-1-rfried.dev@gmail.com>
Ramon Fried-4 wrote
> + if (strcmp((char *)pkt + i, "windowsize") == 0) {
> For servers that doesnt support windowsize option the above check could
> result in accessing memory outside of valid range. Please check if (i+11)
> < len before comparing the strings.
>
>
> +
> + if (ntohs(*(__be16 *)pkt) != (ushort)(tftp_cur_block + 1)) {
> + debug("Received unexpected block: %d, expected: %d\n",
> + ntohs(*(__be16 *)pkt),
> + (ushort)(tftp_cur_block + 1));
> + /*
> + * If one packet is dropped most likely
> + * all other buffers in the window
> + * that will arrive will cause a sending NACK.
> + * This just overwellms the server, let's just send one.
> + */
> + if (tftp_last_nack != tftp_cur_block) {
> + tftp_send();
> + tftp_last_nack = tftp_cur_block;
> + tftp_next_ack = (ushort)(tftp_cur_block +
> + tftp_windowsize);
> + }
> + break;
> + }
> +
> + tftp_cur_block++;
>
> Monotonically increasing the tftp_cur_block will cause error for cases
> where sequence number wraps around as tftp_cur_block is ulong, thus during
> wraparound the check ntohs(*(__be16 *)pkt) != (ushort)(tftp_cur_block + 1)
> will fail and incorrectly generate ACK, and the connection will eventually
> be terminated once the retry is exhausted. Please modulo the increment
> with TFTP_SEQUENCE_SIZE.
> --
> 2.26.2
Quoted from:
http://u-boot.10912.n7.nabble.com/PATCH-v4-net-tftp-Add-client-support-for-RFC-7440-tp412754.html
--
Sent from: http://u-boot.10912.n7.nabble.com/
next prev parent reply other threads:[~2020-06-03 2:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 19:25 [PATCH v4] net: tftp: Add client support for RFC 7440 Ramon Fried
2020-05-22 0:29 ` rahasij
2020-05-22 19:19 ` Ramon Fried
2020-05-23 17:39 ` Matthias Brugger
2020-05-23 17:59 ` Ramon Fried
2020-06-03 2:54 ` Ravik Hasija [this message]
2020-06-04 16:17 ` Ramon Fried
2020-06-04 17:51 ` Ravik Hasija
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1591152886830-0.post@n7.nabble.com \
--to=rahasij@linux.microsoft.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox