summaryrefslogtreecommitdiff
path: root/cmd/net.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-06-14 15:50:04 -0400
committerTom Rini <trini@konsulko.com>2023-06-14 15:50:04 -0400
commit2f4664f5c3edc55b18d8906f256a4c8e303243c0 (patch)
tree438153aa69df3c1af0dc04848b507f5a833787dd /cmd/net.c
parent19b77d3d23966a0d6dbb3c86187765f11100fb6f (diff)
parent2f7c7159ea4c0e5c2aa7671c5b5a2889d0abe7ce (diff)
Merge branch '2023-06-14-assorted-fixes'
- Fix some issues Coverity Scan reported in IPv6, SPL EXTn support fix, two small bootstd fixes, one Kconfig dependency fix, and fix booting on Pinephone Pro
Diffstat (limited to 'cmd/net.c')
-rw-r--r--cmd/net.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/net.c b/cmd/net.c
index 68d406291ef..9e1f40a56e9 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -209,7 +209,7 @@ U_BOOT_CMD(
static void netboot_update_env(void)
{
- char tmp[44];
+ char tmp[46];
if (net_gateway.s_addr) {
ip_to_string(net_gateway, tmp);
@@ -274,20 +274,20 @@ static void netboot_update_env(void)
if (IS_ENABLED(CONFIG_IPV6)) {
if (!ip6_is_unspecified_addr(&net_ip6) ||
net_prefix_length != 0) {
- sprintf(tmp, "%pI6c", &net_ip6);
if (net_prefix_length != 0)
- sprintf(tmp, "%s/%d", tmp, net_prefix_length);
-
+ snprintf(tmp, sizeof(tmp), "%pI6c/%d", &net_ip6, net_prefix_length);
+ else
+ snprintf(tmp, sizeof(tmp), "%pI6c", &net_ip6);
env_set("ip6addr", tmp);
}
if (!ip6_is_unspecified_addr(&net_server_ip6)) {
- sprintf(tmp, "%pI6c", &net_server_ip6);
+ snprintf(tmp, sizeof(tmp), "%pI6c", &net_server_ip6);
env_set("serverip6", tmp);
}
if (!ip6_is_unspecified_addr(&net_gateway6)) {
- sprintf(tmp, "%pI6c", &net_gateway6);
+ snprintf(tmp, sizeof(tmp), "%pI6c", &net_gateway6);
env_set("gatewayip6", tmp);
}
}