Multi-AP: Avoid memcpy(ptr, NULL, 0) in WPS Registrar initialization

This can result in compiler warnings due to the unexpected NULL pointer
as a source memory even when the length of the copied data is 0.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2019-02-23 11:37:20 +02:00
parent 2c129a1b71
commit 1415d4b82d

View file

@ -698,9 +698,13 @@ wps_registrar_init(struct wps_context *wps,
reg->dualband = cfg->dualband; reg->dualband = cfg->dualband;
reg->force_per_enrollee_psk = cfg->force_per_enrollee_psk; reg->force_per_enrollee_psk = cfg->force_per_enrollee_psk;
os_memcpy(reg->multi_ap_backhaul_ssid, cfg->multi_ap_backhaul_ssid, if (cfg->multi_ap_backhaul_ssid) {
cfg->multi_ap_backhaul_ssid_len); os_memcpy(reg->multi_ap_backhaul_ssid,
reg->multi_ap_backhaul_ssid_len = cfg->multi_ap_backhaul_ssid_len; cfg->multi_ap_backhaul_ssid,
cfg->multi_ap_backhaul_ssid_len);
reg->multi_ap_backhaul_ssid_len =
cfg->multi_ap_backhaul_ssid_len;
}
if (cfg->multi_ap_backhaul_network_key) { if (cfg->multi_ap_backhaul_network_key) {
reg->multi_ap_backhaul_network_key = reg->multi_ap_backhaul_network_key =
os_memdup(cfg->multi_ap_backhaul_network_key, os_memdup(cfg->multi_ap_backhaul_network_key,