From nobody Fri May 3 08:47:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+92299+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+92299+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1660123469; cv=none; d=zohomail.com; s=zohoarc; b=Exu3qwjayk5XKAEBUi3uRmWmV5vtzWudpfEVdekjdGi69KtnAdgDWtqHgyAOGYCJaX3QXlcXV44tREk9UbbVFYz/BnBRQ1dREkCvZLj42dbc7H/xSKd5iVysj3Iy0ehurHxmbWXPLfQpB30lPQkCEmHCXJ1utvYJqn6Mn9a3jkM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660123469; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=i/oxioPCLN7qy9vGpGSdSxNBIVE7/jD/XPoosIzhCfA=; b=fpyKe72GAj9hGs1MehEufA9441HX1oYQkMmjvDewKYcdcZc5TOssJgvOgFU2e+0CiqjuXOOu+ishkzJ5I1MmJmW9HCCVTakeRsF6girIgZH4rrFYEVqUZ/mKJtDB6LkkIcs5EvDPVXnFRtO0yNWH3cfvia3Muhyzy7w9yk3WQ3M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+92299+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1660123469978553.7220917309721; Wed, 10 Aug 2022 02:24:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id o36yYY1788612xyqKIhNRTTu; Wed, 10 Aug 2022 02:24:29 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web08.3740.1660123468721732629 for ; Wed, 10 Aug 2022 02:24:28 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10434"; a="270815388" X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208";a="270815388" X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2022 02:24:28 -0700 X-IronPort-AV: E=Sophos;i="5.93,226,1654585200"; d="scan'208";a="932821132" X-Received: from mmowka-mobl.ger.corp.intel.com ([10.102.90.90]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2022 02:24:27 -0700 From: "mateusz-mowka" To: devel@edk2.groups.io Cc: rebecca@nuviainc.com, michael.d.kinney@intel.com, mateusz-mowka Subject: =?UTF-8?B?W2VkazItZGV2ZWxdIFtQQVRDSCB2MV0gRnJvbTogTWF0ZXVzeiBNw7N3a2EgPG1hdGV1c3oubW93a2FAaW50ZWwuY29tPiBTdWJqZWN0OiBbZWRrMi1saWJjXSBBZGQgc3RybmxlbiBmdW5jdGlvbiB3cmFwcGVy?= Date: Wed, 10 Aug 2022 11:24:14 +0200 Message-Id: <20220810092414.467-1-mateusz.mowka@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,mateusz.mowka@intel.com X-Gm-Message-State: XPhR0HmkAMdrwp7RtJGNOKiVx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1660123469; bh=i/oxioPCLN7qy9vGpGSdSxNBIVE7/jD/XPoosIzhCfA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=N0xkvPsuAfrQLfnnIrrp2dJNmUWp33IeDnGSk23eZdNT5r+b/DiyU0bFgmAmk8j1fFe vet136oPBZK0uXiE/bmXznbNdi9qUx7XqiK1EYeG46fnfGufOqghCpIovLQwzF86Vydjj g17qvbRwdKlP/OSN1ekgaWulkmQCqSbjOJ4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1660123471678100003 This patch adds strnlen function wrapper that internally calls AsciiStrnLenS defined in BaseLib. Signed-off-by: Mateusz M=C3=B3wka Reviewed-by: Michael D Kinney --- StdLib/Include/string.h | 11 +++++++++++ StdLib/LibC/String/Misc.c | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/StdLib/Include/string.h b/StdLib/Include/string.h index 0c80944..73193aa 100644 --- a/StdLib/Include/string.h +++ b/StdLib/Include/string.h @@ -62,6 +62,7 @@ void *memset (void *s, int c, size_t n); char *strerror (int num); size_t strlen (const char *); + size_t strnlen (const char *s, size_t n); =20 ################ BSD Compatibility Functions char *strdup (const char *); @@ -454,6 +455,16 @@ char *strerror(int Num); **/ size_t strlen(const char *S); =20 +/** The strnlen function computes the length of a fixed-size string. + + @param[in] S Pointer to the string to determine the length of. + @param[in] N Length of a string including the terminating character. + + @return The strnlen function returns the number of characters that + precede the terminating null character but not exceeding N. +**/ +size_t strnlen(const char *S, size_t N); + =20 /* ################ BSD Compatibility Functions ######################= # */ =20 diff --git a/StdLib/LibC/String/Misc.c b/StdLib/LibC/String/Misc.c index f024136..8afffce 100644 --- a/StdLib/LibC/String/Misc.c +++ b/StdLib/LibC/String/Misc.c @@ -99,3 +99,17 @@ strlen(const char *s) { return (size_t)AsciiStrLen( s); } + +/** The strnlen function computes the length of a fixed-size string. + + @param[in] s Pointer to the string to determine the length of. + @param[in] n Length of a string including the terminating character. + + @return The strnlen function returns the number of characters that + precede the terminating null character but not exceeding N. +**/ +size_t +strnlen(const char *s, size_t n) +{ + return (size_t)AsciiStrnLenS( s, n); +} --=20 2.34.0.windows.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited. -=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 (#92299): https://edk2.groups.io/g/devel/message/92299 Mute This Topic: https://groups.io/mt/92932922/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-