]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: incorrect buffer size in efi_file_setinfo()
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 10 Nov 2020 06:24:16 +0000 (07:24 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 14 Nov 2020 04:05:46 +0000 (05:05 +0100)
When copying a string with must allocate a byte for the terminating '\0' in
the target buffer.

Fixes: fbe4c7df0087 ("efi_loader: enable file SetInfo()")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_file.c

index 44fafae05868f60a2913096f876fed4c4aa164a1..72b7ec1e63c1ab9d9a9d13c931a84a3aa595fa7a 100644 (file)
@@ -723,7 +723,7 @@ static efi_status_t EFIAPI efi_file_setinfo(struct efi_file_handle *file,
                        goto out;
                }
                /* Check for renaming */
-               new_file_name = malloc(utf16_utf8_strlen(info->file_name));
+               new_file_name = malloc(utf16_utf8_strlen(info->file_name) + 1);
                if (!new_file_name) {
                        ret = EFI_OUT_OF_RESOURCES;
                        goto out;