Bufferoverflow on eMMC partition handling

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 3 04:38:11 PDT 2024


On Mon, Sep 02, 2024 at 11:37:56AM +0200, Florian Otte wrote:
> Hi Everyone.
> 
> I tried to use all general purpose partitions on an eMMC storage
> device and ran into some trouble. In ./include/mci.h the number of
> partitions is limited to 6, but there might be 7 partitions. This
> results in a buffer overflow or access out of bound and causes a nasty
> bootloop when all general purpose-partitions are used. I created a
> simple patch and appended it to this mail.
> 
> Kind regards
> fotte
> 
> [Edit]: Sorry. Clicked the wrong button to fast. Now with Attachment.

> From 0bae0df23bbc4a9e98f1bcac6c6fbe0c3b21bc78 Mon Sep 17 00:00:00 2001
> From: Florian Otte <fotte at uos.de>
> Date: Mon, 2 Sep 2024 11:27:47 +0200
> Subject: [PATCH] FIX: buffer overflow on MCI-partition enumeration
> 
> Memory for up to 6 partitions is reserved, however there can be up to 7
> partitions on an mci storage (e.g. emmc). A user partition two boot partitions
> and up to four general pupose partitions.
> ---
>  include/mci.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Your patch lacks a Signed-off-by: line. Please respond with such a line.

Otherwise ok, thanks for fixing this. I additionally created a patch to
check for the array boundaries.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list