From: stsp Date: Tue, 24 Jan 2023 16:18:22 +0000 (+0000) Subject: Fix a crash in iwx(4) when connecting to WEP networks via ifconfig join. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6a7986fdbfcd482446abea279f2cde206e166370;p=openbsd Fix a crash in iwx(4) when connecting to WEP networks via ifconfig join. In if_iwx.c r1.63 / CVS commit ID QzTzJtyPl10L63Yi, I fixed a problem with connecting to WPA1/TKIP networks. This change introduced a deference of the 'ni' pointer passed to ic_set_key(). This pointer will be passed in as NULL in certain situations, such as when WEP is used. Add the missing NULL check. reported by and fix tested by matthieu@ --- diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index 51ad8c29378..30f9dd2bd76 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.151 2022/12/23 11:29:32 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.152 2023/01/24 16:18:22 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -8056,7 +8056,7 @@ iwx_set_key(struct ieee80211com *ic, struct ieee80211_node *ni, if (k->k_cipher != IEEE80211_CIPHER_CCMP) { /* Fallback to software crypto for other ciphers. */ err = ieee80211_set_key(ic, ni, k); - if (!err && (k->k_flags & IEEE80211_KEY_GROUP)) + if (!err && in != NULL && (k->k_flags & IEEE80211_KEY_GROUP)) in->in_flags |= IWX_NODE_FLAG_HAVE_GROUP_KEY; return err; }