Received: by 2002:a17:906:fa94:b0:a1c:d2de:9065 with SMTP id lt20csp2297182ejb; Fri, 8 Dec 2023 04:54:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFX6VFB65ROKFOYXaP9DM+1CaC8VDyEk1Jbe9rz/aEw0Eq0twVOLjZXwiFOdxqlAPhi0Nw+ X-Received: by 2002:a05:6102:321b:b0:464:7c13:c7bf with SMTP id r27-20020a056102321b00b004647c13c7bfmr31789vsf.57.1702040051572; Fri, 08 Dec 2023 04:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702040051; cv=none; d=google.com; s=arc-20160816; b=iLuwDjbZ1D4rFgX4VQJeJUUomQ5fQxza6XOvx1DU29zGQgJKfo/6TQDTZCt+MQr8yo X2QblqLR6HqqIqowSgbnIjwQI24SWHuUCdC5Z2kGND0vjvgZ5/Rke22SvfxfLj0L4ZWR 9jw/fE/frzaSf2KNprmqwYjyTsdyIUyA8t7hETJ726FFSPW19U1nuDn+gwKJVcoffKUI jrugAqFXRPdwRvaUUBauh/7Bq+qB1SElIKLp1StLtiZsujSDBV7kcuIYSNo5sjHWhOCn q/QR93IjX7/8Dhe7TIwCLCmVRTH7QDVfvogyuOCtGpvO63etdtwLfpdHU7BVaqfm2rMq dfRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :mime-version:date:message-id:dkim-signature; bh=6G0OL2BJgOrKj5CWSn1mbBD4f1PotPBOucH5A6jfylc=; fh=HQjKvw74nlY3ORvMdwb5/Ggo46cySA9wVKnqE+sQS4o=; b=Qi/eCh9OAv9hUgpOw6eIoaD9sV+SUdw7u0xptMzJ+PlLpH8oCx614ErkCxocHTIAb1 HxnqQm0t/Otct5MhS6B83Z3DSsBP88LFqh5SxyipXmOfVIngCkSL2XuZdCUmL+T1epJn BcTmO9glcPQWsUM0m006PIdvbgR7oSmbjqIY15J0dPGvU9idI3+LseX52gTBta7WyMF3 s5uS2hKATwdYJ69SNhtEB4Yf0XqiB0S27NOiri1x9wTEu84ehqLTz0xWo8sUm86MN+Rh 8VCPSJ7vh/TheK82XvA8nnAr/aXaqcKUMJFioJOkNX2jrutCHzYfuryEXefDfAr1AiY0 holw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jQUG7WrL; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cw4-20020ad44dc4000000b0067a9a5163f9si1970280qvb.461.2023.12.08.04.54.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Dec 2023 04:54:11 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jQUG7WrL; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBaMU-0008Id-FP; Fri, 08 Dec 2023 07:53:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBaMT-0008I1-5H for qemu-arm@nongnu.org; Fri, 08 Dec 2023 07:53:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBaMR-0004zO-OX for qemu-arm@nongnu.org; Fri, 08 Dec 2023 07:53:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702040022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6G0OL2BJgOrKj5CWSn1mbBD4f1PotPBOucH5A6jfylc=; b=jQUG7WrLmhpl2IAAgDR2qha3/1/41ZnjqLptkOqpDkQ6tl2up7BjYAi2yDcXgVgIrz4C/T 1YJ8ZhnNNpupXm8rA7zEfadtRDkFvhzaSVfafwveXjK5RzgXymri2JtEXuOghU7OyFrjIB Jkrxg0urnNuwUD0e3jcc/+Mo3XnwSo4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-438-_2AngrqqO5masZLOtE9lxA-1; Fri, 08 Dec 2023 07:53:38 -0500 X-MC-Unique: _2AngrqqO5masZLOtE9lxA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9C0B3C02B81; Fri, 8 Dec 2023 12:53:37 +0000 (UTC) Received: from [10.39.193.124] (unknown [10.39.193.124]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8F8E3C2E; Fri, 8 Dec 2023 12:53:35 +0000 (UTC) Message-ID: Date: Fri, 8 Dec 2023 13:53:34 +0100 MIME-Version: 1.0 Subject: Re: [PATCH 05/16] hw/uefi: add var-service-core.c Content-Language: en-US To: Gerd Hoffmann Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, Eric Blake , Thomas Huth , Michael Roth , Paolo Bonzini , Peter Maydell , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , graf@amazon.com, =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Markus Armbruster References: <20231115151242.184645-1-kraxel@redhat.com> <20231115151242.184645-6-kraxel@redhat.com> From: Laszlo Ersek In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 Received-SPF: pass client-ip=170.10.133.124; envelope-from=lersek@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: dRiUnNyIbxBs On 11/22/23 17:30, Gerd Hoffmann wrote: > Hi, > >> - in general, we should filter out surrogate code points, for any use. >> any UCS2 string from the guest that contains a surrogate code point >> should be considered invalid, and the request should be rejected based >> just on that. > > Something like this? yes please (except I'd recommend s/outlaw/reject/ in the comment) Thanks laszlo > > edk2 seems to be inconsistent with strings, sometimes they are expected > to include a terminating '\0' char (most of the time), sometimes not > (in variable policies for example). > > gboolean uefi_str_is_valid(const uint16_t *str, size_t len, > gboolean must_be_null_terminated) > { > size_t pos = 0; > > for (;;) { > if (pos == len) { > if (must_be_null_terminated) { > return false; > } else { > return true; > } > } > switch (str[pos]) { > case 0: > /* end of string */ > return true; > ;; > case 0xd800 ... 0xdfff: > /* outlaw surrogates */ > return false; > default: > /* char is good, check next */ > break; > } > pos++; > } > } > > take care, > Gerd >