From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ivan Gorinov Date: Tue, 8 May 2018 15:50:54 -0700 Subject: [U-Boot] [PATCH] efi_loader: fix off-by-one bug in efi_get_variable Message-ID: <20180508225054.GA32586@intel.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de efi_get_variable() always stores an extra zero byte after the output data. When the returned data size matches the output buffer size, the extra zero byte is stored past the end of the output buffer. Signed-off-by: Ivan Gorinov --- lib/efi_loader/efi_variable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 6c177da..d031338 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -68,11 +68,11 @@ static const char *hex2mem(u8 *mem, const char *hexstr, int count) do { int nibble; - *mem = 0; - if (!count || !*hexstr) break; + *mem = 0; + nibble = hex(*hexstr); if (nibble < 0) break; -- 2.7.4