From 6bb9d9a8db899278032eac6e7df7d7b999a9956e Mon Sep 17 00:00:00 2001 From: Andrei Otcheretianski Date: Wed, 3 Apr 2019 18:17:16 +0300 Subject: [PATCH] AP: Avoid NULL use with snprintf string identity_buf may be NULL here. Handle this case explicitly by printing "N/A" instead relying on snprintf converting this to "(null)" or some other value based on unexpected NULL pointer. Signed-off-by: Andrei Otcheretianski --- src/ap/ieee802_1x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index a56c82e56..870329a85 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -2733,7 +2733,8 @@ int ieee802_1x_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta, wpa_auth_sta_key_mgmt(sta->wpa_sm))) ? 1 : 2, (unsigned int) diff.sec, - sm->identity ? (char *) sm->identity : identity_buf); + sm->identity ? (char *) sm->identity : + (identity_buf ? identity_buf : "N/A")); os_free(identity_buf); if (os_snprintf_error(buflen - len, ret)) return len;