]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efivars: check path_len before using it as loop boundary 10356/head
authorDavid Tardon <dtardon@redhat.com>
Wed, 10 Oct 2018 12:54:05 +0000 (14:54 +0200)
committerDavid Tardon <dtardon@redhat.com>
Fri, 12 Oct 2018 12:51:35 +0000 (14:51 +0200)
src/shared/efivars.c

index 3931bee559867ebda53719f267cfcd59e4ed1199..da70e68c81643ea45f0d6ff05469c5b1fba34814 100644 (file)
@@ -412,9 +412,13 @@ int efi_get_boot_option(
 
         if (header->path_len > 0) {
                 uint8_t *dbuf;
-                size_t dnext;
+                size_t dnext, doff;
+
+                doff = offsetof(struct boot_option, title) + title_size;
+                dbuf = buf + doff;
+                if (header->path_len > l - doff)
+                        return -EINVAL;
 
-                dbuf = buf + offsetof(struct boot_option, title) + title_size;
                 dnext = 0;
                 while (dnext < header->path_len) {
                         struct device_path *dpath;