summaryrefslogtreecommitdiff
path: root/load-options.c
diff options
context:
space:
mode:
authorDan Nicholson <dbn@endlessos.org>2024-10-02 16:51:18 -0600
committerPeter Jones <pjones@redhat.com>2025-01-15 15:59:30 -0500
commitd8c86b740667544acccad92c06eddbc858808a74 (patch)
tree2fd0b007b14d7d0643fc5ee2e171d18925afb69e /load-options.c
parentac85ba4342314c3e6f248d4946138de2f977dd52 (diff)
downloadefi-boot-shim-d8c86b740667544acccad92c06eddbc858808a74.tar.gz
efi-boot-shim-d8c86b740667544acccad92c06eddbc858808a74.zip
shim: Allow data after the end of device path node in load options
When looking for load option optional data, the parser asserts that the byte after the end of device path node is the same as what the file path length says it should be. While unusual, it is valid if the end of device path node comes before the end of the file path list. That supports some unusual Dell load options where there are two device paths in the list but the first is terminated by an End Entire Device Path. Maybe they intended to use an End Device Path Instance node there? Who knows. Either way, treating it as invalid ends up trying to read paths from the beginning of the option with obviously poor results. Fixes: #649 Signed-off-by: Dan Nicholson <dbn@endlessos.org>
Diffstat (limited to 'load-options.c')
-rw-r--r--load-options.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/load-options.c b/load-options.c
index 84fcfb7e..e7b64471 100644
--- a/load-options.c
+++ b/load-options.c
@@ -207,14 +207,14 @@ get_load_option_optional_data(VOID *data, UINT32 data_size,
*/
i += dp.len;
}
- if (i != fplistlen)
+ if (i > fplistlen)
return EFI_INVALID_PARAMETER;
/*
- * if there's any space left, it's "optional data"
+ * Anything left after the file path list is optional data.
*/
- *od = cur + i;
- *ods = limit - i;
+ *od = cur + fplistlen;
+ *ods = limit - fplistlen;
return EFI_SUCCESS;
}