From patchwork Thu Apr 4 18:16:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juliusz Sosinowicz X-Patchwork-Id: 1919901 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=wYIV/Zna; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wolfssl-com.20230601.gappssmtp.com header.i=@wolfssl-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=BE/RZoYF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V9VG15rKnz23v5 for ; Fri, 5 Apr 2024 05:17:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NufLNnA+kt1tHI/CdXo5QyqySgaYZ43t1siDwNYp9eU=; b=wYIV/Znaf4BDZU GImsTc+UyFkojigJEmcj2ePo9xLTq8yvJi8MKqtQ+Q39Dsy0ZDD3k3MjV4vtaMmZusXViVL73Asg8 r02O8wr1ED+I0lwzzoD09INltmOeuNJ4sXnohU/26fisll7uaU3o7PfxC+yvf10daBlyJVNgHe8OW qE0m46ped6IoXYlGIXhDLHMAVooYnTyNBi5tVqkeJ2POb8MHH37Ft0RjHRfs10Y3gQfn7Bjw/3O+v q5GuqUTH0e25Q+jkNjr24uDcq7ekxpKF8q8rpquhhKxA14v8UfWwBzPH3DMdTGxdrMesjhywT+lVU 7MUX2oYBDXEdhVontkkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsRe5-00000003mhg-3PWB; Thu, 04 Apr 2024 18:17:05 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsRe2-00000003meC-0EWb for hostap@lists.infradead.org; Thu, 04 Apr 2024 18:17:04 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-56e1bbdb362so1582913a12.1 for ; Thu, 04 Apr 2024 11:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfssl-com.20230601.gappssmtp.com; s=20230601; t=1712254619; x=1712859419; darn=lists.infradead.org; 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=Ogbx5YyV7gC5c8w9NcRVNPdDek4rjvGBSFDud54gZ4g=; b=BE/RZoYFMvTpdjEnJ4boWupkn3Km305ilFNl36cf5fDFygTAlyb8My/XdeNP0/tgUI ++/GTCsx7i6IzTGGEgzVgzx8IvJXieTSzwVmQ9pDChv9Afvsczk04uS/6hp35iqvlzrs 3myU6LDBhE3grksJdZCFI7GbupcCdsXPyXfcDex86Wj5g8hoaGemueq7wd5igBPEZ90E Q4UvVwSI7bDfRCBlgjANt9htC2tKdEJvjh2rVhINm0OkOGtMZnvRJQKhdwUFaJBb/+KA wZny5tTJs+sIi6rlmqYv9b2qBD3PaB0q2D6BnPMBKPJErRRI72AgEO7JIGUqDxiSLreq hHmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712254619; x=1712859419; 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=Ogbx5YyV7gC5c8w9NcRVNPdDek4rjvGBSFDud54gZ4g=; b=LhVNdQFcKOqu72gnKvWaeyhFu6ktU8gwkfOou11BTgmaT6f3p6MXLdVgBO1aiKg/Je ws+XFAuZVyRvJRT8S/qpfxUuwzrT/WtVKiHnOwAtl5AILfqxhHou0pmBvGp6jS+7ugAj GPdAQqxhUufQsCclSvBg1mEPHRnV4v6VKK4Yb+vNegqjohFe5q9Rf+ENL85N///SdU0f n42fXqlHQ/Z4gzuvo3E7Y4e5LZDa0gKhEgXiQ1qvlmgud0/IldbD07fNNKcLFXWjP6Mw mVl4irufqoaZkxCnS81VGYNz47gNYFI+4+8BINV+5UeweN+9rcsC6bnCHDXin9VFv/Jh ZBhA== X-Gm-Message-State: AOJu0YwjabHBLujClFstVksNKoTejyGw5ufNdN2bqCAXCI5HY5x3Ibn+ fsJFQ566x7jYdsT/Df/+kA57k6pzDULYmXn1zle4ruOUAx1bGz86LXgI24N1oXxtgwznsF5A3or TWPE= X-Google-Smtp-Source: AGHT+IGUo479t1/ceop4bADGnBpVIUcBjO0RX/udXso2sMvTlfJf5Hun2zNB3jRudge+cR9KONJYoQ== X-Received: by 2002:a50:d71e:0:b0:56d:fdb3:bcc0 with SMTP id t30-20020a50d71e000000b0056dfdb3bcc0mr433019edi.11.1712254618893; Thu, 04 Apr 2024 11:16:58 -0700 (PDT) Received: from localhost.localdomain ([82.118.30.15]) by smtp.gmail.com with ESMTPSA id dh26-20020a0564021d3a00b0056e0b358e86sm1976349edb.97.2024.04.04.11.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 11:16:58 -0700 (PDT) From: Juliusz Sosinowicz To: hostap@lists.infradead.org Cc: Juliusz Sosinowicz Subject: [PATCH 04/24] wolfssl: fix get_x509_cert Date: Thu, 4 Apr 2024 20:16:10 +0200 Message-Id: <20240404181630.2431991-4-juliusz@wolfssl.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240404181630.2431991-1-juliusz@wolfssl.com> References: <20240404181630.2431991-1-juliusz@wolfssl.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_111702_454237_6BDE6D1A X-CRM114-Status: GOOD ( 12.55 ) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The conditional was checking if data was not present. We should be allocating the buffer when data *is* present. Signed-off-by: Juliusz Sosinowicz --- src/crypto/tls_wolfssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:52b listed in] [list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The conditional was checking if data was not present. We should be allocating the buffer when data *is* present. Signed-off-by: Juliusz Sosinowicz --- src/crypto/tls_wolfssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/tls_wolfssl.c b/src/crypto/tls_wolfssl.c index 26832ed430..e851dd09d1 100644 --- a/src/crypto/tls_wolfssl.c +++ b/src/crypto/tls_wolfssl.c @@ -961,7 +961,7 @@ static struct wpabuf * get_x509_cert(WOLFSSL_X509 *cert) int cert_len; data = wolfSSL_X509_get_der(cert, &cert_len); - if (!data) + if (data) buf = wpabuf_alloc_copy(data, cert_len); return buf;