]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ERP: Silence static analyzer warning
authorJouni Malinen <j@w1.fi>
Mon, 1 May 2017 19:06:53 +0000 (22:06 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 1 May 2017 19:08:16 +0000 (22:08 +0300)
The check for erp->keyname_nai within eap_erp_get_key() is apparently
too difficult for some static analyzers to notice. Add an explicit check
for os_strchr() return value being non-NULL to avoid false reports.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/eap_peer/eap.c

index d0f305f1acb068d34497cd7359bd067afd534c1a..5ca24603ee052ca346649d0cd7511176f517287c 100644 (file)
@@ -534,6 +534,8 @@ int eap_peer_get_erp_info(struct eap_sm *sm, struct eap_peer_config *config,
                return -1; /* SEQ has range of 0..65535 */
 
        pos = os_strchr(erp->keyname_nai, '@');
+       if (!pos)
+               return -1; /* this cannot really happen */
        *username_len = pos - erp->keyname_nai;
        *username = (u8 *) erp->keyname_nai;