From: Andrei Otcheretianski Date: Wed, 3 Apr 2019 15:17:16 +0000 (+0300) Subject: AP: Avoid NULL use with snprintf string X-Git-Tag: hostap_2_8~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bb9d9a8db899278032eac6e7df7d7b999a9956e;p=thirdparty%2Fhostap.git 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 --- 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;