Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch: check for user network interface before reading hostname #984

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 4292f8b7c4aa38b68d22c413f91bdc95192cfad6 Mon Sep 17 00:00:00 2001
From: pennam <[email protected]>
Date: Tue, 29 Oct 2024 11:30:00 +0100
Subject: [PATCH] Add user network interface check before reading hostname

---
connectivity/lwipstack/source/LWIPInterface.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/connectivity/lwipstack/source/LWIPInterface.cpp b/connectivity/lwipstack/source/LWIPInterface.cpp
index 64869a3538..da964543c7 100644
--- a/connectivity/lwipstack/source/LWIPInterface.cpp
+++ b/connectivity/lwipstack/source/LWIPInterface.cpp
@@ -446,9 +446,11 @@ nsapi_error_t LWIP::add_ethernet_interface(EMAC &emac, bool default_if, OnboardN
interface->memory_manager = &memory_manager;
interface->ppp_enabled = false;

- hostname = user_network_interface->get_hostname();
- if (hostname) {
- netif_set_hostname(&interface->netif, hostname);
+ if (user_network_interface) {
+ hostname = user_network_interface->get_hostname();
+ if (hostname) {
+ netif_set_hostname(&interface->netif, hostname);
+ }
}

#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
--
2.45.2