diff mbox series

AP: Fix potential NULL dereference in ieee802_1x_get_mib_sta()

Message ID 20190403151719.12165-6-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series AP: Fix potential NULL dereference in ieee802_1x_get_mib_sta() | expand

Commit Message

Andrei Otcheretianski April 3, 2019, 3:17 p.m. UTC
identity_buf may be NULL. Handle this case correctly.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 src/ap/ieee802_1x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jouni Malinen April 6, 2019, 3:51 p.m. UTC | #1
On Wed, Apr 03, 2019 at 06:17:16PM +0300, Andrei Otcheretianski wrote:
> identity_buf may be NULL. Handle this case correctly.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c
index a56c82e564..870329a859 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;