[PATCH v4 10/14] net-lwip: add wget command

Jon Humphreys jhumphreysti at gmail.com
Mon Jun 24 08:25:19 CEST 2024


Subject: [PATCH] net-lwip: fixes off-by-one array access error with wget

When wget parses the url and extracts the host, it is off by one on the
index to terminate the character array.

Signed-off-by: Jonathan Humphreys <j-humphreys at ti.com>
---
 net-lwip/wget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net-lwip/wget.c b/net-lwip/wget.c
index 069299bd469..63b19b99112 100644
--- a/net-lwip/wget.c
+++ b/net-lwip/wget.c
@@ -51,7 +51,7 @@ static int parse_url(char *url, char *host, u16 *port, char **path)
 		return -EINVAL;
 
 	memcpy(host, p, pp - p);
-	host[pp - p + 1] = '\0';
+	host[pp - p] = '\0';
 
 	if (*pp == ':') {
 		/* Parse port number */
-- 
2.34.1



More information about the U-Boot mailing list