efi_loader: endless loop in add_strings_package()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 19 Mar 2019 11:30:27 +0000 (12:30 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Wed, 20 Mar 2019 17:16:53 +0000 (18:16 +0100)
Avoid an endless loop in add_strings_package().

Suggested-by: Takahiro Akashi <takahiro.akashi@linaro.org>
Reported-by: Coverity (CID 185833)
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_hii.c

index 3a966fa4dff44af1f5480320110f1c1cd724cbed..61b71dec621b0be2bb474da55a5a6e456e6f0b25 100644 (file)
@@ -227,9 +227,8 @@ out:
 error:
        if (stbl) {
                free(stbl->language);
-               if (idx > 0)
-                       while (--idx >= 0)
-                               free(stbl->strings[idx].string);
+               while (idx > 0)
+                       free(stbl->strings[--idx].string);
                free(stbl->strings);
        }
        free(stbl);