diff mbox series

[06/14] client: check NULL return for DPP cmd_show

Message ID 20220706212851.92685-6-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [01/14] client: add generic display function for table rows | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood July 6, 2022, 9:28 p.m. UTC
If the DPP interface goes away this could return NULL which was
unchecked. Caught by static analysis.
---
 client/dpp.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/client/dpp.c b/client/dpp.c
index cd05a33b..a659f545 100644
--- a/client/dpp.c
+++ b/client/dpp.c
@@ -284,6 +284,11 @@  static enum cmd_status cmd_show(const char *device_name,
 			device_proxy_find(device_name, IWD_DPP_INTERFACE);
 	char *caption = l_strdup_printf("%s: %s", "DPP", device_name);
 
+	if (!proxy) {
+		display("No DPP interface on device: '%s'\n", device_name);
+		return CMD_STATUS_INVALID_VALUE;
+	}
+
 	proxy_properties_display(proxy, caption, MARGIN, 20, 47);
 	l_free(caption);