Fix HS20_GET_NAI_HOME_REALM_LIST hex length check (CID 68108)

Due to an incorrect operation (MOD vs. AND), the code that was supposed
to return an error if the hex string has odd length was not really
reporting any failures. Instead of reporting an error, the invalid
control interface command would have been truncated. This is not an
issue in practice, but better fix the implementation anyway.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-06-12 18:38:31 +03:00
parent beb9e1171e
commit 0e87e798b5

View file

@ -5368,7 +5368,7 @@ static int hs20_get_nai_home_realm_list(struct wpa_supplicant *wpa_s,
if (len == 0 && cred && cred->realm) if (len == 0 && cred && cred->realm)
return hs20_nai_home_realm_list(wpa_s, dst_addr, cred->realm); return hs20_nai_home_realm_list(wpa_s, dst_addr, cred->realm);
if (len % 1) if (len & 1)
return -1; return -1;
len /= 2; len /= 2;
buf = os_malloc(len); buf = os_malloc(len);