From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cpsmtpb-ews06.kpnxchange.com (cpsmtpb-ews06.kpnxchange.com [213.75.39.9]) by ml01.01.org (Postfix) with ESMTP id EC7FB21E47D4E for ; Wed, 23 Aug 2017 23:57:54 -0700 (PDT) Received: from cpsps-ews18.kpnxchange.com ([10.94.84.184]) by cpsmtpb-ews06.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Thu, 24 Aug 2017 09:00:28 +0200 Received: from CPSMTPM-CMT101.kpnxchange.com ([195.121.3.17]) by cpsps-ews18.kpnxchange.com with Microsoft SMTPSVC(8.5.9600.16384); Thu, 24 Aug 2017 09:00:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; d=kpnmail.nl; s=kpnmail01; c=relaxed/relaxed; t=1503558017; h=mime-version:date:message-id:subject:from:to:content-type; bh=fCjl8OJ5mQWTvxiVX8buQp/oJxn53ceIvygBRwgo1CU=; b=Azo8h1svbyskGQGP+k3VlcNZBKwikQUGgbtU3oL2DeB3gnh6rQG+DR00ni+7LPxJfMOEZcda/OC CHjWFALwGohjg4BkhumbbcvkUddmMF9s03XPnQRiLrDvvk9hf28K3U8DKR01WCSea4cs/HCTA55z6 74zZeQc6iLbY4sNTf4M= Received: from Eltsrv03.Eltan.local ([84.85.114.86]) by CPSMTPM-CMT101.kpnxchange.com over TLS secured channel with Microsoft SMTPSVC(8.5.9600.16384); Thu, 24 Aug 2017 09:00:17 +0200 Received: from Eltsrv03.Eltan.local (192.168.100.3) by Eltsrv03.Eltan.local (192.168.100.3) with Microsoft SMTP Server (TLS) id 15.0.847.32; Thu, 24 Aug 2017 08:59:42 +0200 Received: from Eltsrv03.Eltan.local ([fe80::24e7:1cc6:a76a:a3a8]) by Eltsrv03.Eltan.local ([fe80::24e7:1cc6:a76a:a3a8%12]) with mapi id 15.00.0847.040; Thu, 24 Aug 2017 08:59:24 +0200 From: Wim Vervoorn To: "edk2-devel@lists.01.org" Thread-Topic: HiiValidateSettings issue with string item Thread-Index: AdMcpNentLeKDSmqQfmCOUmOTFDv3g== Date: Thu, 24 Aug 2017 06:59:23 +0000 Message-ID: <03b999a0727d4026a810530b59caeba5@Eltsrv03.Eltan.local> Accept-Language: nl-NL, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.100.108] MIME-Version: 1.0 X-OriginalArrivalTime: 24 Aug 2017 07:00:17.0506 (UTC) FILETIME=[A4920C20:01D31CA6] X-RcptDomain: lists.01.org X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: HiiValidateSettings issue with string item X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Aug 2017 06:57:55 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, I am running into an issue with HiiValidateSettings (); when my VFR contain= s a string item that is filled with a string of maximum length. In this cas= e the validation returns an error because it thinks the string is too long. During the validation ValidateQuestionFromVfr (); checks if the stringlengt= h is valid. The issue is that this uses the "maxsize" value * 2 from the VF= R. It does this using the StrSize function which includes the trailing term= inator. This is of course correct. The maxsize from the VFR indicates only = the amount of characters excluding the terminator. As a quickfix I changed the ValidateQuestionFromVfr () to take this into ac= count but I am doubting if this is the correct solution. Can you shed some = light here? Below is the fragment where I see this issue: // // Get Offset/Width by Question header and OneOf Flags // Offset =3D IfrString->Question.VarStoreInfo.VarOffset; // // Check whether this question is in current block array. // if (!BlockArrayCheck (CurrentBlockArray, Offset, Width)) { // // This question is not in the current configuration string. = Skip it. // break; } // // Check this var question is in the var storage // if ((Offset + Width) > VarStoreData.Size) { // // This question exceeds the var store size. // return EFI_INVALID_PARAMETER; } // // Check current string length is less than maxsize // // Please note we subtract sizeof(CHAR16) here because the StrS= ize returns the length including the terminator // while we specify the length in characters in the VFR! // ORG -> // if ( (StrSize ((CHAR16 *) (VarBuffer + Offset)) >= Width) { CHANGED-> if ( (StrSize ((CHAR16 *) (VarBuffer + Offset)) - size= of(CHAR16)) > Width) { return EFI_INVALID_PARAMETER; } } break; Best Regards, Wim Vervoorn Eltan B.V. Ambachtstraat 23 5481 SM Schijndel The Netherlands T : +31-(0)73-594 46 64 E : wvervoorn@eltan.com W : http://www.eltan.com "THIS MESSAGE CONTAINS CONFIDENTIAL INFORMATION. UNLESS YOU ARE THE INTENDE= D RECIPIENT OF THIS MESSAGE, ANY USE OF THIS MESSAGE IS STRICTLY PROHIBITED= . IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE IMMEDIATELY NOTIFY THE= SENDER BY TELEPHONE +31-(0)73-5944664 OR REPLY EMAIL, AND IMMEDIATELY DELE= TE THIS MESSAGE AND ALL COPIES."