efi_loader: fix unreachable statement in efi_sigstore_parse_siglist

"if (left < esl->signature_size)" is not reachable in a while loop.
But it is still valuable in case that a given signature database is
somehow corrupted. So fix the while loop condition.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
AKASHI Takahiro 2020-04-21 09:38:57 +09:00 committed by Heinrich Schuchardt
parent e3f5c9cb0f
commit 964d5326c9

View File

@ -667,7 +667,7 @@ efi_sigstore_parse_siglist(struct efi_signature_list *esl)
esd = (struct efi_signature_data *)
((u8 *)esl + sizeof(*esl) + esl->signature_header_size);
while ((left > 0) && left >= esl->signature_size) {
while (left > 0) {
/* Signature must exist if there is remaining data. */
if (left < esl->signature_size) {
debug("Certificate is too small\n");