efi_loader: correct reading of directories
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 7 Sep 2019 20:34:07 +0000 (22:34 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 9 Sep 2019 13:21:08 +0000 (15:21 +0200)
commit83a74ad14370b75051cabfc2eab01fd8556f3bdb
treebbbb1f4d57e019c0780df6d8f8162f25f76b0744
parent87c4840610e037018b9df30b1a31896b0bd284a9
efi_loader: correct reading of directories

EFI_FILE_PROTOCOL.Read() is used both to read files and directories.

When reaching the end of a directory we always have to return buffer size
zero irrespective of the incoming buffer size. (The described scenario for
a Shim quirk cannot arise because every directory has at least '.' and '..'
as entries.)

Even when the buffer_size is too small multiple times we have to keep a
reference to our last read directory entry.

When we return to the start of the directory via SetPosition() we must
remove the reference to a previously kept directory entry.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_file.c