diff --git a/src/library_manager/lib_manager.c b/src/library_manager/lib_manager.c index 96b8289b3249..83dc0c25bf24 100644 --- a/src/library_manager/lib_manager.c +++ b/src/library_manager/lib_manager.c @@ -728,6 +728,16 @@ static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext, uint32_t preload_size = man_desc->header.preload_page_count * PAGE_SZ; int ret; + /* + * The module manifest structure always has its maximum size regardless of + * the actual size of the manifest. + */ + if (preload_size < MAN_MAX_SIZE_V1_8) { + tr_err(&lib_manager_tr, "Invalid preload_size value %x.", preload_size); + return -EINVAL; + } + + /* Prepare storage memory, note: it is never freed, library unloading is unsupported */ /* * Prepare storage memory, note: it is never freed, it is assumed, that this * memory is abundant, so we store all loaded modules there permanently