From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by mx.groups.io with SMTP id smtpd.web09.7502.1573147646310241028 for ; Thu, 07 Nov 2019 09:27:26 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Fp66bkQT; spf=pass (domain: linaro.org, ip: 209.85.221.68, mailfrom: leif.lindholm@linaro.org) Received: by mail-wr1-f68.google.com with SMTP id t1so3995621wrv.4 for ; Thu, 07 Nov 2019 09:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=we1Hw36RxYheAf4ObdmylUrM2EGRU54z4a3Yd5GBMNY=; b=Fp66bkQTCHtqyJ+/NdK3Y/lInEi/PQN8MW06vPAQRs+LWUi/s894rbr6HgUQHPcl8I uFRuBBzG9Jy0wl5cWAPq4rEBeISyYAx5TghLMX7tmqrkRV7EY7yNidkKbPdsT4rv+ig/ qA8D8hx/P6U/hPngTAu5v0/1mNuwuTxggmMSttrdTfy64wTPimv3X6rmblfYJPiWh4CW IYv6c9x4VDs8zZbTp+IbKHHuaoadlHsu5kCD82ttkHU4ug/kFM4uEma4l9VK9YO2mAYx obpm+rZf472fCyoEt630gZcTPP+ltOEjKIWGR28YCnY9kBarNhhuBN1HeqNpK8FgngJP J31w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=we1Hw36RxYheAf4ObdmylUrM2EGRU54z4a3Yd5GBMNY=; b=C5l2WRqs0TIiGIYZTquxu+I7LTBtmnsxCGHXKWR9mR8SfOBFmfDrJojDQSiSZDE1A2 T1irFTJmOHm3CxT67zGKdbOx21INFFD8kZ4vLhcucsGQSZjlYy1M1RRDf+lfGKniJLV2 dRIFTPpdAUZaVJ+P2Ny6XwDz6qk1TJc3WbfIIu9F7neWVLjXm2+3HbN64FM0Am6/zz6L wHBJS4KoUU3H3tz4pVdd3YxOuG/4kMv+aj+mqnyt2znoH2ytkRFZE64Lp1L5vaGgSsLU kLUIg7Ogz+2Aog/Vgwhytqzx8/tExyZHlXB+BVYqCcQqY2KSx0ytu6rTIc6+uPi5hQ4q YWUg== X-Gm-Message-State: APjAAAXUxF7pR7g697qQksp/oPN59mcF6zBBh8XxMYwn4J+mJunvY5Eh umKPwPWhmPIE7aS8NhgMUdhZoA== X-Google-Smtp-Source: APXvYqzrajAufQDdB0kUzF0U3cH2P2Rk9nx9zpxdEBleCPnUroMUv3sf+mxyiId/ZY0RfaNoQ3RcIQ== X-Received: by 2002:a5d:4403:: with SMTP id z3mr3836321wrq.44.1573147644859; Thu, 07 Nov 2019 09:27:24 -0800 (PST) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id o18sm3611383wrm.11.2019.11.07.09.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 09:27:24 -0800 (PST) Date: Thu, 7 Nov 2019 17:27:22 +0000 From: "Leif Lindholm" To: Pete Batard Cc: devel@edk2.groups.io, ard.biesheuvel@linaro.org, philmd@redhat.com Subject: Re: [edk2-platforms][PATCH 1/1] Platform/RPi: Prevent buffer over-read when the command line is empty Message-ID: <20191107172722.GV16820@bivouac.eciton.net> References: <20191104160617.11036-1-pete@akeo.ie> <20191107162130.GQ16820@bivouac.eciton.net> <27d409b1-1761-8fe6-5c51-c4f53df3ce60@akeo.ie> MIME-Version: 1.0 In-Reply-To: <27d409b1-1761-8fe6-5c51-c4f53df3ce60@akeo.ie> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Nov 07, 2019 at 05:05:20PM +0000, Pete Batard wrote: > Hi Leif, > > On 2019.11.07 16:21, Leif Lindholm wrote: > > Patch looks good, but the term "command line" is a bit confusing. > > > > I assume we're talking about whatever way parameters are passed from > > pre-edk2 firmware to edk2, right? > > Yes. This is basically what the Raspberry Pi VideoCore bootcode digests and > passes as boot arguments to the ARM boot loader (i.e. our TF-A + EFI > firmware executable). It contains options that the user may have set in > their 'config.txt' as well as other data. Sure. > > Is there a more precise term for this? > > Would "boot arguments" or "external boot arguments" work for you? Or if you > prefer "(external) boot parameters" should be applicable too. Either would be fine - I was just hoping there might be a recognized standard name for them :) So, I could update the subject line to Platform/RPi: Prevent external boot arguments over-read in order to keep it short, and change "command line" in the commit message body to "external boot arguments" - does that work for you? Regards, Leif > Regards, > > /Pete > > > > > / > > Leif > > > > On Mon, Nov 04, 2019 at 04:06:17PM +0000, Pete Batard wrote: > > > From: Andrei Warkentin > > > > > > It is possible for the command line to be empty > > > (Cmd->TagHead.TagValueSize = 0), in which case the code should not > > > attempt to read the value at CommandLine[-1]. > > > > > > Signed-off-by: Pete Batard > > > --- > > > Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c > > > index 5a9d4c3f1787..9b4aa068857c 100644 > > > --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c > > > +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c > > > @@ -927,7 +927,8 @@ RpiFirmwareGetCommmandLine ( > > > CopyMem (CommandLine, Cmd->CommandLine, Cmd->TagHead.TagValueSize); > > > - if (CommandLine[Cmd->TagHead.TagValueSize - 1] != '\0') { > > > + if (Cmd->TagHead.TagValueSize == 0 || > > > + CommandLine[Cmd->TagHead.TagValueSize - 1] != '\0') { > > > // > > > // Add a NUL terminator if required. > > > // > > > -- > > > 2.21.0.windows.1 > > > >