atheros: Get rid of static analyzer warnings on 0-length memcpy

These functions can potentially be called with ie == NULL and ie_len ==
0. Check explitcitly for the ie == NULL case to avoid confusing
memcpy(dst, NULL, 0) calls.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-05-01 17:45:53 +03:00
parent 470f08b4f6
commit d912953e37

View file

@ -716,9 +716,13 @@ atheros_set_opt_ie(void *priv, const u8 *ie, size_t ie_len)
wpa_hexdump(MSG_DEBUG, "atheros: set_generic_elem", ie, ie_len);
wpabuf_free(drv->wpa_ie);
if (ie)
drv->wpa_ie = wpabuf_alloc_copy(ie, ie_len);
else
drv->wpa_ie = NULL;
app_ie = (struct ieee80211req_getset_appiebuf *) buf;
if (ie)
os_memcpy(&(app_ie->app_buf[0]), ie, ie_len);
app_ie->app_buflen = ie_len;
@ -1005,6 +1009,7 @@ atheros_set_wps_ie(void *priv, const u8 *ie, size_t len, u32 frametype)
beac_ie = (struct ieee80211req_getset_appiebuf *) buf;
beac_ie->app_frmtype = frametype;
beac_ie->app_buflen = len;
if (ie)
os_memcpy(&(beac_ie->app_buf[0]), ie, len);
/* append the WPA/RSN IE if it is set already */