From nobody Wed May 1 23:40:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51775+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51775+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1575535576; cv=none; d=zohomail.com; s=zohoarc; b=RWi3siNIkW962K/TNK7TCGZzjqYwsz2HihuaAVLdA5Z3BaAuFNp8Rnh1KcNidEy8fL8oRrEBBZ5+NzmVk94p48a1Sn7bprtVNWfd+6CeLzJhrc4NMMm0dBdEoUAIYPYvUMFuvx+WObgR9PHne936bnK8sKZGHFbq+8j3IfRvjUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575535576; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=pLnDilXpcwIWgLUDxiRNXv+QzUuehuBgnctzan0bGQ8=; b=OdkAGqAI9aq7d8fANC3so0U9hchqXW1z8bmEJATEt3WyNdXDiL5miJzA95kJ5+uj+aN3+m6DCMsKfsX3jUrepXToycRPLQ1rPMksW9sOJNZQDfEBseBGXs7namazhIpAaB/cYOG1OydA8Xe6FPJD/1BslNc9I7z12MD6lW3Hmfc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51775+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1575535576043367.6344490511051; Thu, 5 Dec 2019 00:46:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id alyPYY1788612xTINnn92B6u; Thu, 05 Dec 2019 00:46:15 -0800 X-Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web12.6466.1575535574341023847 for ; Thu, 05 Dec 2019 00:46:14 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2019 00:46:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,280,1571727600"; d="scan'208";a="214066211" X-Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga006.jf.intel.com with ESMTP; 05 Dec 2019 00:46:12 -0800 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Jian J Wang , Xiaoyu Lu Subject: [edk2-devel] [PATCH] CryptoPkg/SysCall: Cast variables from 4 to 8-byte size Date: Thu, 5 Dec 2019 16:46:07 +0800 Message-Id: <20191205084607.34208-1-shenglei.zhang@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,shenglei.zhang@intel.com X-Gm-Message-State: uTCS4TjAgjVf2CUAGtCTNKCsx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1575535575; bh=vZMhvzmRH076u/3UWBinC5CzoHgAkvldoX1z7Z4co4k=; h=Cc:Date:From:Reply-To:Subject:To; b=LzHPNujOmFpzUL4Cv7WzMFjw1y/iCcbbdPQBhhEIdfb2htLumq6Ag8f7Z3Kf7xBKC7i LrMLnvRzmUxSjonLkUabglNUqAtzkczcDlBrqptqdk/r0ry4V3pZDaVKBKtLZfPEIOafJ LZQmxPm9oALC1SWl2MN7AQcSSwtnVQj/2HU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" tp, pch, digits and xdigits are both 4-byte-size, but not cast to 8-byte-size when operated with 8-byte-size variables. This is a issue reported by my local static tool. Cc: Jian J Wang Cc: Xiaoyu Lu Signed-off-by: Shenglei Zhang --- CryptoPkg/Library/BaseCryptLib/SysCall/inet_pton.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/inet_pton.c b/CryptoPkg= /Library/BaseCryptLib/SysCall/inet_pton.c index 32e1ab8690e6..ad392b18ca66 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/inet_pton.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/inet_pton.c @@ -132,7 +132,7 @@ inet_pton4( const char *pch; =20 if ((pch =3D strchr(digits, ch)) !=3D NULL) { - u_int new =3D *tp * 10 + (u_int)(pch - digits); u_int new =3D (u_int)(*tp) * 10 + (u_int)pch - (u_int)digits; =20 if (new > 255) return (0); @@ -200,7 +200,7 @@ inet_pton6( pch =3D strchr((xdigits =3D xdigits_u), ch); if (pch !=3D NULL) { val <<=3D 4; - val |=3D (pch - xdigits); val |=3D (u_int)pch - (u_int)xdigits; if (val > 0xffff) return (0); saw_xdigit =3D 1; --=20 2.18.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51775): https://edk2.groups.io/g/devel/message/51775 Mute This Topic: https://groups.io/mt/66944007/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-