public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: emohandesi@linux.microsoft.com
To: u-boot@lists.denx.de
Cc: joe.hershberger@ni.com, rfried.dev@gmail.com
Subject: [PATCH] net: ipv6: Fixed IPv6 string to address conversion off-by-one error
Date: Fri, 13 Jan 2023 09:27:41 -0800	[thread overview]
Message-ID: <1673630861-32383-1-git-send-email-emohandesi@linux.microsoft.com> (raw)

From: Ehsan Mohandesi <emohandesi@microsoft.com>

One extra character was being checked in the IPv6 string which caused the
last character of the address to be neither '\0' nor ':'. This raises an
error condition and causes the function to always return an error. This
issue was resolved by this fix.

Signed-off-by: Ehsan Mohandesi <emohandesi@microsoft.com>
---
 net/tftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tftp.c b/net/tftp.c
index c780c33..328fd90 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -837,7 +837,7 @@ void tftp_start(enum proto_t protocol)
 			e = strchr(net_boot_file_name, ']');
 			len = e - s;
 			if (s && e) {
-				string_to_ip6(s + 1, len, &tftp_remote_ip6);
+				string_to_ip6(s + 1, len - 1, &tftp_remote_ip6);
 				strlcpy(tftp_filename, e + 2, MAX_LEN);
 			} else {
 				strlcpy(tftp_filename, net_boot_file_name, MAX_LEN);
-- 
1.8.3.1


             reply	other threads:[~2023-01-13 20:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 17:27 emohandesi [this message]
2023-01-16 12:01 ` [PATCH] net: ipv6: Fixed IPv6 string to address conversion off-by-one error Vyacheslav V. Mitrofanov
2023-02-03 18:20 ` Tom Rini

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=1673630861-32383-1-git-send-email-emohandesi@linux.microsoft.com \
    --to=emohandesi@linux.microsoft.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.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