diff --git a/grub-core/map/lib/wim.c b/grub-core/map/lib/wim.c index b61be90..ead6f91 100644 --- a/grub-core/map/lib/wim.c +++ b/grub-core/map/lib/wim.c @@ -296,7 +296,8 @@ int wim_count ( struct vfat_file *file, struct wim_header *header, int rc; /* Count metadata entries */ - for ( offset = 0 ; ( offset + sizeof ( entry ) ) <= header->lookup.len ; + for ( offset = 0, *count = 0 ; + ( offset + sizeof ( entry ) ) <= header->lookup.len ; offset += sizeof ( entry ) ) { /* Read entry */ diff --git a/grub-core/map/lib/wimpatch.c b/grub-core/map/lib/wimpatch.c index eb64840..cfd9528 100644 --- a/grub-core/map/lib/wimpatch.c +++ b/grub-core/map/lib/wimpatch.c @@ -688,6 +688,10 @@ static int wim_construct_patch ( struct vfat_file *file, &patch->boot ) ) != 0 ) return rc; + /* Update boot image metadata in patched header, if applicable */ + if ( boot_index ) + memcpy ( boot, &patch->boot, sizeof ( *boot ) ); + /* Record original boot index */ patch->boot_index = patch->header.boot_index;