1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

wifi: fix possible null-pointer dereference on sta_mac

p->sp->sta_mac is not mandatory set so check it before accessing it.

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
Andrey Gusakov 2014-08-11 14:01:41 +04:00 committed by David Herrmann
parent 58c76ccfd1
commit eecf576fa9

View file

@ -115,7 +115,7 @@ static struct supplicant_peer *find_peer_by_any_mac(struct supplicant *s,
struct peer *p; struct peer *p;
LINK_FOREACH_PEER(p, s->l) { LINK_FOREACH_PEER(p, s->l) {
if (!strcmp(p->p2p_mac, mac) || !strcmp(p->sp->sta_mac, mac)) if (!strcmp(p->p2p_mac, mac) || (p->sp->sta_mac && !strcmp(p->sp->sta_mac, mac)))
return p->sp; return p->sp;
} }