]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
disk: Fix possible out-of-bounds access in part_efi.c
authorMarek Vasut <marex@denx.de>
Sun, 19 May 2013 12:53:34 +0000 (12:53 +0000)
committerTom Rini <trini@ti.com>
Tue, 4 Jun 2013 20:06:32 +0000 (16:06 -0400)
commit67cd4a63487400317f1586b130bc2475767a5315
tree794c9e2022186512f21f82e2ddc72c75e79e2073
parent301e8038678a70762144c0e9de3513fca3a13cb8
disk: Fix possible out-of-bounds access in part_efi.c

Make sure to never access beyond bounds of either EFI partition name
or DOS partition name. This situation is happening:

part.h:     disk_partition_t->name is 32-byte long
part_efi.h: gpt_entry->partition_name is 36-bytes long

The loop in part_efi.c copies over 36 bytes and thus accesses beyond
the disk_partition_t->name .

Fix this by picking the shortest of source and destination arrays and
make sure the destination array is cleared so the trailing bytes are
zeroed-out and don't cause issues with string manipulation.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Simon Glass <sjg@chromium.org>
disk/part_efi.c