From patchwork Fri Mar 1 19:40:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13579038 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72AAD3F8D9 for ; Fri, 1 Mar 2024 19:41:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322064; cv=none; b=ZzNgXbw4k8e96aiVAH/k3QihCOYWk7ie7HpGvfXAaumpPik6GiVw62lntXKdJEh9DRz1hh18p5eUTSIb34rd6vOOvouIhO7YPnvCIWBWzmIxTRIeVFPog9zi+R7q1qqd6wLNxDMijvg2KD5fUWWK+9FVSRAeyMEFRzeQYxkXejo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322064; c=relaxed/simple; bh=lj4QW0jSsg2NgCHN69LlslB+2wXTYOqzNjZ/NOX9CBw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=DUoIlLneLTwfGqVn0qFGS1OgudJbvXwnpsLv50Qdx1V1/SwUmBFuiD8VD24O617mvCFSMZIH2ErjIRNyOByTwJQEjjosJm7cngXg6N4y2G7zgP4Iuz8KlXmBx2He0PZsFQE1wbw8wsFP2kJLvavMazGSA6MU7e/f1gpgfwM62L8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CRgOdrbU; arc=none smtp.client-ip=209.85.219.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CRgOdrbU" Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-68fcedcf8aaso10872266d6.2 for ; Fri, 01 Mar 2024 11:41:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709322062; x=1709926862; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wDIckw1ifN+8BTd+L66m/equ0POj/+AQCQG5kM27P+A=; b=CRgOdrbUZAl0rZHxNL2Sd2em+28foDW2aVixsHosCEY2xjcdtdYM9LsfdjhU8tFlTB Ig4Hz2xDOZ6dso5/aC5XrNcBp3eIUWTjKja+tZ7RsZVXQdmhISueVMys2aMZHrBOvzaO VaaQI5Yz+Axlf7KmMs3VvJgsmPp7mcbiwv43vW7UFs4lS+xaTQMH+LcIxDYuQLnZ1GVn J2LsyAEISC6JqsB/uPUQyAkBguMRKDkvAxIAZ0RE1ocgrnlsCNTEIBsYgym64aHCwRGr 55XKWNdNzgWtzuoL9jFa4yuPTfbB3ir8STTQxbvpB2LrYgsdydp5+V8xIIrD5G4WQX/E CjIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709322062; x=1709926862; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wDIckw1ifN+8BTd+L66m/equ0POj/+AQCQG5kM27P+A=; b=Im4E0j+8ERlFOSzg4AirRJzCBuhXZirUH/nEQCx9acaDsty2Hg8O+XgMFtswXFu3C2 5DQSOaEWB0B/4BWva5p8f+1A8Njw01Ia3hupS5Iy7/NWTEcHdI20cBMXucOIuX+cLM9U j/MWBKLK1W3a6CtpP/+UHMYHOVuU5cFVP5JywCg+0sTanqHAl6pf3DSpd98i2QCDlxlN kFH79ZH8V7RBqVV4NppUwNM7nnyztC0vWWJtcdrvIY50r/LE2qVHbn5r72WdxAbFTj9F kNC9M9MGKsRz3eMsk0qUTIUsbXIdz43fwrK7RwK2+ks1Hme2ClzkO6Ua2v26ZqvPPKo0 ntZg== X-Gm-Message-State: AOJu0Yw647w83OmV7wtQ3QicmgyHiIvuAGsskoSfJyRpeyDe+lnzcLDF aumUtHbVeuNzxmJcfnsLEQIagYO4ID2MzG++hkothsdJnNRR80Di7dSgO/NS X-Google-Smtp-Source: AGHT+IGtw1Z7ssSuZnFYYKJpgZPDRian+MU6LWzAhUGVEXkmoVt74tMr2X3wtUI+Rwk9I2Z3VNtSIg== X-Received: by 2002:a0c:cc87:0:b0:68f:a13d:ee26 with SMTP id f7-20020a0ccc87000000b0068fa13dee26mr2606336qvl.21.1709322061782; Fri, 01 Mar 2024 11:41:01 -0800 (PST) Received: from LOCLAP699.rst-02.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mu4-20020a056214328400b0068fd10638c0sm2162397qvb.20.2024.03.01.11.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:41:01 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/4] p2p: check connected peer before processing request Date: Fri, 1 Mar 2024 11:40:53 -0800 Message-Id: <20240301194056.1665549-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Caught by static analysis, the dev->conn_peer pointer was being dereferenced very early on without a NULL check, but further it was being NULL checked. If there is a possibility of it being NULL the check should be done much earlier. --- src/p2p.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p2p.c b/src/p2p.c index 08fe8444..205d4fcb 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -2310,6 +2310,9 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu, if (!peer) return; + if (!dev->conn_peer) + return; + if (body_len < 8) return; @@ -2438,7 +2441,7 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu, memcpy(dev->conn_peer_interface_addr, req_info.intended_interface_addr, 6); - if (dev->is_go && dev->conn_peer) { + if (dev->is_go) { p2p_set_group_id(dev); dev->conn_config_delay = From patchwork Fri Mar 1 19:40:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13579039 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78B7D3EA71 for ; Fri, 1 Mar 2024 19:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322068; cv=none; b=Im2wnaYYOV9Ph2xDX6jIXQL5d/qnUSRlsUeAo0JXLfQ9AyseK8zFmppSfRiHDyX4xf1kwpHxgb3ktldljE4ix1jfHUzHldMeezHceZKezkn78fE+RoKc17E9oVV5NT0XQ8ZMGDI1O+nucQ7/agkjZOx4mdZrAB3KnN3/8X/6Wlg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322068; c=relaxed/simple; bh=kTNGXoHMvDG/GrvNJAs49iceNFI2++f1WXnkWHQr0Og=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ryu/Y5EigvEJ8AQfIUxvVQrrH3B1UwrKINYR6pyXbYQKXKp1Gk7aPQylFJwTo0XstIrC/LsWkiNWMXAo0PIJ3ilAuXar0y6wi96nJW9FF9wtEo0sLrjwgvm/Cahr8wiP4gB+A7RoQyam9a1+gfFGLXU5QOYZ0g1+V808s5GGdqw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CBf4Lqw2; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CBf4Lqw2" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5a0cf64bafbso1312830eaf.2 for ; Fri, 01 Mar 2024 11:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709322065; x=1709926865; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=alswkIXf7vPYGiptsX9N0GOdlXPllSG3F2QWufv5xUk=; b=CBf4Lqw2KNke3RXg4UjDauZ3yMB+pCkeX4VPmk274xvELp5OPZ3Dzse6Xre9IM3OI4 ykMitypCb58hSiOJZXSl+2l/R4dTqzZ1kry//H1Zx7QAGuEo06s+mF2dHdbQF+mCsOJz oXLjV5xC/mr6KnYxPKjDFnlgEtX3dz7JWOOPS4BCfLSX9SK3aMYJPm/b1rqODC03TeuI WWfRT4U0EYoeqFFLfJ7TIoG+noumucEsXn4yvmgAgReAHLlyxzK26jn3bVM/lmyfxfoU 0cqz1hg6aXZijouy/VNn2VL7ghYY0U+Da0AI3K/bNDvwZ5WvyvC+9UqKDXeWUKYoKwZN AF5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709322065; x=1709926865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=alswkIXf7vPYGiptsX9N0GOdlXPllSG3F2QWufv5xUk=; b=S40/X+376M6J6YLWkZfT10iT3V7isbArZwMb/iGGECIS6dPNPubmisf15ZbNM2i6WF 8MuPIEMctUlgaBT8JGPmQHkWWXuPoGsGui2VPL9CR2DKMVVGA45iyddrqs2griw0HOA2 X6OrTNC01YMKq5/uxv3yVekwTcnOPX+NbDb9UEssMyGjaIEP3JWpJQGw9n/tGZQ0CKfw yuCm+1tsD9z6ZxPjpI8IEBpaTmoXYwLOsJdmtYV8CdtnK7qGzY5zg+kMrfuZ1XM5HLJ+ hgqmOf42o5oYepaFh9bM0yZOUN+OF5sEMJSWS2OCwHfbjCUN/iHLgjTsYb+LRs1z6g0+ vSzw== X-Gm-Message-State: AOJu0Yzif3ZT2kAbvfDBQFuFeih7tLJahpuZfcIFGYKXDYGyOTEQm9fw VY6DUc89pJII48DP3lw5Y008Dt0Pu2ZhjvCGBuKqzzGdbIf+0RM7UlehLhte X-Google-Smtp-Source: AGHT+IF1+tz2BHslWTeQeTKJVdOQeHGP9xvDgBE3zjTr7dQQYj/rbrqxAnjogwMw9I81t/CCc3XGGA== X-Received: by 2002:a05:6358:7e9d:b0:17b:f259:3098 with SMTP id o29-20020a0563587e9d00b0017bf2593098mr2423794rwn.3.1709322064998; Fri, 01 Mar 2024 11:41:04 -0800 (PST) Received: from LOCLAP699.rst-02.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mu4-20020a056214328400b0068fd10638c0sm2162397qvb.20.2024.03.01.11.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:41:04 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/4] eap-mschapv2: Check Password-Hash exists when loading settings Date: Fri, 1 Mar 2024 11:40:54 -0800 Message-Id: <20240301194056.1665549-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301194056.1665549-1-prestwoj@gmail.com> References: <20240301194056.1665549-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Caught by static analysis, the Password-Hash was never validated so it could end up memcpying from a NULL pointer. --- src/eap-mschapv2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/eap-mschapv2.c b/src/eap-mschapv2.c index ef0ce620..7f71cc82 100644 --- a/src/eap-mschapv2.c +++ b/src/eap-mschapv2.c @@ -532,6 +532,9 @@ static bool eap_mschapv2_load_settings(struct eap_state *eap, snprintf(setting, sizeof(setting), "%sPassword-Hash", prefix); hash = l_settings_get_bytes(settings, "Security", setting, &hash_len); + if (!hash) + goto error; + memcpy(state->password_hash, hash, 16); explicit_bzero(hash, 16); l_free(hash); From patchwork Fri Mar 1 19:40:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13579040 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0684A3FB07 for ; Fri, 1 Mar 2024 19:41:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322069; cv=none; b=VBsld17zH/Ac2GJzKRfYKEVQEWrkMfDqEUBKI+YLRIY18KMnydka9fvcbFSEXm0WwrYbd4kn5yPOBl1fTuZ6HmiTvi5f8RFQlhhuXMjAe4yoainf6ll+8f5a2pG5QBGgr7W+k/L/9279YgWOxsN6Qg9UH1BuS1kCsTzN+E1RSk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322069; c=relaxed/simple; bh=dMTqAjczu/YuHI0pRI5UBIDvZ+k7Q+T7xp/BaVl1GZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uSie46JE1BgwWfy1QTy7X+PvxOvEQVGWaGT4TjPCX+ybOSw6zzcAXzAjpN+mf/QGC8UFFPtclgoHXOEUauAv3UvyuZspuywYRPewmU8Vo+ZaerXFLJm1pgXirKFjmR46fB4e2vbvrrmoZ8Tc9exP6uzMaVRWXbAFGO+HlJWf4DM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GXXx76TJ; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GXXx76TJ" Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5a078ac712eso1108463eaf.1 for ; Fri, 01 Mar 2024 11:41:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709322067; x=1709926867; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eDhYPFk8DEPjIlyKGdwuIZ7utfc/yywu/kXcmo2L2kg=; b=GXXx76TJLoHTlIvqBzNHIXl+ndvGaKTH1sc6CsqlEKIwmVv+MO+n1dcKd3c1Ooae8r 5J7o+voIOKndgjUeuFqxSKdu/KfR+wxXKRnVjN6BvyVpawDeOwa1AU+rcpep62ZFUkgF MjOumBrQ31GQU/wKcQP2GWbRMJCdUQonAMBS74mxLb24kGQh0MyMyPspGNIlpf56Fo+b tMZTlzzsLa7hIMAjT5GcPg6pxYe325fGZJEwpZAzx/7+hYq/36QrnTifocXlz7gKgc2j i31jB40ZznkFU1P4ud6VDz1HD6IVN64Td7cxRZH92t1VAW0AlaO5McVdB9w5kNXOp4JT zMLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709322067; x=1709926867; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eDhYPFk8DEPjIlyKGdwuIZ7utfc/yywu/kXcmo2L2kg=; b=j+02YsU/0fN25ubKdlu6fiYtrax7jF76sUmoarPmhFFVEmsFau8SvodPz3ygFp9wux Kfl9Rv34vhPV/f4Xk2pggfrh4tcB01DLI3olIKwW9C3Iu1z47jowlav6ujxaEAeMmofn NzdpiJ2YTPdfrPOp6Q3QkmK1ZrSUowaCFaXla/9J3xSfLixYz3tczo607cDEEFcmulwc AZFiV2VZ+hNjKu2FlexbvtujGD4O2ZFiFrWL4EUCbSbtdg4qZaw5juXSUvkHUqIOXox1 lmmph5tPAvSb1pNaVNkwRKE+dehAW4770kwdYkNg9pstQlQOaY/ntRPmm6pzXTbv/Jjf 9AnQ== X-Gm-Message-State: AOJu0YybS1OayVWlo2QNGYGtVow1VzDBfXcN6WQSqqm6TmtFO06qNclO hj+BYEMeUj3+gfp5InQyVQT80NkoD4HPAylMShSUISll4qwvF4lnWzEe0WMz X-Google-Smtp-Source: AGHT+IGGPupPmK9GsnK2+8m87NBBW09zAwTO6NSINyeY64Gp8llCqBKYGsA+iHlx3oCrUIuMZtv6kw== X-Received: by 2002:a05:6358:998b:b0:178:f895:5978 with SMTP id j11-20020a056358998b00b00178f8955978mr3588018rwb.10.1709322066884; Fri, 01 Mar 2024 11:41:06 -0800 (PST) Received: from LOCLAP699.rst-02.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mu4-20020a056214328400b0068fd10638c0sm2162397qvb.20.2024.03.01.11.41.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:41:06 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/4] monitor: properly mask HE capabilities bitfield Date: Fri, 1 Mar 2024 11:40:55 -0800 Message-Id: <20240301194056.1665549-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301194056.1665549-1-prestwoj@gmail.com> References: <20240301194056.1665549-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Caught by static analysis, the bitfield was incorrect and was masking 8 entries (0xff), not 5 (0x1f). --- monitor/nlmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monitor/nlmon.c b/monitor/nlmon.c index bb8cd496..6fe63b8d 100644 --- a/monitor/nlmon.c +++ b/monitor/nlmon.c @@ -1689,7 +1689,7 @@ static void print_ie_he_capabilities(unsigned int level, { const uint8_t *ptr = data; uint8_t width_set = bit_field((ptr + 6)[0], 1, 7); - uint8_t mask = 0xff; + uint8_t mask = 0x1f; const char *he_channel_width_bitfield[] = { [0] = "40MHz supported (2.4GHz)", From patchwork Fri Mar 1 19:40:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13579041 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28860446D4 for ; Fri, 1 Mar 2024 19:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322072; cv=none; b=jFoQtl3Fn7qHDqWauisNy3bvyMHcw4Y6tzLgHmcIKKezZ8JY6aKBnk2isU3eJxAGT+rtHrxy+HPOj3Bt8TTuXoeDAGe8meVu1trPejQa4Q04BH1LD9+dzG4UjQs1DmtXqd1madq8ufTlLbcJO1rDU9pp4aCMgEJ5C//Awf/8IxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709322072; c=relaxed/simple; bh=IrMXSSBU4q+UOaoaVo6htH/yA890MkDVySfSVyoY4C8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PITpo5UFPmTutqCrUUGMAcwt9LQqRgqMt/oKsQfZ98q4d+DvgsUUe0Rd+k6iJWfyfm2vxdMVthziVSIXwx98oDkTYYcQ3Qd25VLYKGcbXSVn69ncOp5+EMF/V7f80iNohi9ntj1VuOcI1FQec2FYx3uHcPq7/4wNiYDbbUoVXFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SIxBwn9g; arc=none smtp.client-ip=209.85.219.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SIxBwn9g" Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-690578e13c4so4329106d6.1 for ; Fri, 01 Mar 2024 11:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709322069; x=1709926869; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ch8xBl/1eTrSRKSodBfPGgMORBECf4wGZT+guCwsCvo=; b=SIxBwn9gysIBXaWOcCI00Jz9Y1TcW57z1umB0xEXH+luo2liQ6jHnwi0HmSvwQwYfY rzkZYxI+dOsk9ifqTufcIfP6x3WH2Vc/5YlvV89FnW/jAOe6HQL/e9Tnx5pVReMSihcj K6Z4tMCE81YzT8jZxG98JO+Lc10gTbyDPLeDqTf97P48sYWluIqQq32p5rnZA7MrlirH C8acI0LAZBRXboFszn7oHQBme8whDK4T0dMgpAA8PiVz2a+O8KUq5KJWhiy5Z7uxBZbt 38ka9j9FtJV/adIbnRzyyNKoraMWPs20OmJ4ZKq5gr2lXzOV5Y7jiq+3FU5jp60Hce8A Wvnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709322069; x=1709926869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ch8xBl/1eTrSRKSodBfPGgMORBECf4wGZT+guCwsCvo=; b=egfR3y9ckYP+Hr4DQCYw3h8b6JeFfYSJZUiEWmAcpVBPJuOkViB/hu7LWSiBi/Mk2M o5p1vgFlXHVpxIzBpt/tcVQoFqv1kRAoU2lNHWgQErueFB9cjgTHoQcBXAVejpskbyZJ greasPcuUPeSofjsSDGLh1DK5wayHt0Darw91OWvdYne0v9Fccdw5mqQHTMpWLl+Lrdz chSsEMF37USQ0b8CmOdsIPm4t9nskzynHMeTGpS6aRCosUY7Bsbs2lxSPfviCkxiIdVs IwYZISGAUcJ+L2oC8bopOGdrWFjm81iXplWV2cczJRtEIpnZDhePy+lHLOtCYPFYzInX 7bMA== X-Gm-Message-State: AOJu0YzJ9rCuyX4c2yr60v1m+tO8DcOhKGBMebOBsTV53Tg+6ILPA0tk TG8CXrrebPFoREmXuv9ONf3JmXgn/xp9iBv6lkW8gcT8HcCiUmi5bA1555ym X-Google-Smtp-Source: AGHT+IE+Drckh7z0aA0RPRPABRk8GKZxQkroCwxcIzK2zkrdcW9g1kHbrZY1hrdYNczeCUX22/dyqQ== X-Received: by 2002:ad4:4f13:0:b0:68f:e46b:47f with SMTP id fb19-20020ad44f13000000b0068fe46b047fmr2482142qvb.17.1709322068779; Fri, 01 Mar 2024 11:41:08 -0800 (PST) Received: from LOCLAP699.rst-02.locus ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id mu4-20020a056214328400b0068fd10638c0sm2162397qvb.20.2024.03.01.11.41.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:41:08 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/4] client: fix two issues caught by static analysis Date: Fri, 1 Mar 2024 11:40:56 -0800 Message-Id: <20240301194056.1665549-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240301194056.1665549-1-prestwoj@gmail.com> References: <20240301194056.1665549-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 - va_end was not being called on an error condition - An uninitialized struct was being accessed if ioctl failed --- client/display.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/display.c b/client/display.c index 64125934..83214c86 100644 --- a/client/display.c +++ b/client/display.c @@ -230,7 +230,8 @@ static void display_refresh_check_feasibility(void) { const struct winsize ws; - ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0) + return; if (ws.ws_col < LINE_LEN - 1) { if (display_refresh.enabled) { @@ -564,8 +565,6 @@ void display_table_row(const char *margin, unsigned int ncolumns, ...) str += entry_append(e, str); } - va_end(va); - display("%s\n", buf); str = buf; @@ -591,6 +590,8 @@ void display_table_row(const char *margin, unsigned int ncolumns, ...) } done: + va_end(va); + for (i = 0; i < ncolumns; i++) { if (entries[i].color) l_free(entries[i].color);