From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id EFA9EAC0ADB for ; Thu, 7 Sep 2023 03:45:16 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=dE/y3EDjKl/bBWcWvNdaBhK4IBoXSwtoX7L5oUc48HM=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1694058315; v=1; b=EJf6SsNVYHuBK1aL7/rLuXzCIzZqcmA8AipLLy3Z866jlFYR/0WPaytVo95p/Y/touft8nND 7BC1sTHwTvIng6YF4H6BeaDg/fGgKdb9CB9sXPvU19F7hrwUL/qrpMfX7twNYA2YCLwn8hzW4Oo JA6I9h0kjmcY6K4TByCz9Ym0= X-Received: by 127.0.0.2 with SMTP id pwjNYY7687511xZS09E6tDEb; Wed, 06 Sep 2023 20:45:15 -0700 X-Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.groups.io with SMTP id smtpd.web11.6005.1694058314751016732 for ; Wed, 06 Sep 2023 20:45:15 -0700 X-Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-401d6f6b2e0so10377995e9.1 for ; Wed, 06 Sep 2023 20:45:14 -0700 (PDT) X-Gm-Message-State: 0BSOASV6pPQw47z2UJCCvbu9x7686176AA= X-Google-Smtp-Source: AGHT+IGDY2KVC52zo15xnpGZy25kd1C8B73fxyugFAAJ+BzxdPpje0XnqaNxRek/hHr2TAoUVbMhjgfgklGGvAl2XZE= X-Received: by 2002:a05:600c:492f:b0:401:431e:2d03 with SMTP id f47-20020a05600c492f00b00401431e2d03mr910505wmp.14.1694058312582; Wed, 06 Sep 2023 20:45:12 -0700 (PDT) MIME-Version: 1.0 References: <20230907033441.1915-2-mjsbeaton@gmail.com> In-Reply-To: <20230907033441.1915-2-mjsbeaton@gmail.com> From: "Mike Beaton" Date: Thu, 7 Sep 2023 04:45:01 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH v5] MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool size To: devel@edk2.groups.io Cc: Eric Dong , Dandan Bi , Ard Biesheuvel Precedence: Bulk 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,mjsbeaton@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=EJf6SsNV; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Thu, 7 Sept 2023 at 04:35, Mike Beaton wrote: > > The immediately preceding call, GetBestLanguage, plus the implementation of > HiiGetString, which is called immediately afterwards, make it clear that > BestLanguage is a null-terminated ASCII string, and not just a five byte, > non-null terminated buffer. > > Therefore AsciiStrLen is one byte too short, meaning that whether the space > allocated is really sufficient and whether the resultant string is really > null-terminated becomes implementation-dependent. Rather than switching to > AsciiStrSize, we use an explicitly compile-time string length calculation > (both compile-time and run-time approaches are currently used elsewhere in > the codebase for copying static strings). Apologies for the multiple versions, but I thought it was important to clarify in the commit message above that this really was a fix, not a misunderstanding. I also realised, in this last version, that sizeof is preferable here to AsciiStrSize (and that sizeof is, in fact, already often used when copying static strings elsewhere in the codebase - both sizeof and (Ascii)StrSize are used in various places, but with more use of sizeof). -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108358): https://edk2.groups.io/g/devel/message/108358 Mute This Topic: https://groups.io/mt/101208544/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-