[PATCH] board: freescale: lx2160a: fix out of bounds write

The declaration of dpmac_str was changed in order to make the following sprintf safe: sprintf(dpmac_str, "ethernet@%x", dpmac_id).
Signed-off-by: Cosmin-Florin Aluchenesei aluchenesei.cosmin-florin@nxp.com --- board/freescale/lx2160a/eth_lx2160ardb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/freescale/lx2160a/eth_lx2160ardb.c b/board/freescale/lx2160a/eth_lx2160ardb.c index 30a3af9f47..f3b33940e3 100644 --- a/board/freescale/lx2160a/eth_lx2160ardb.c +++ b/board/freescale/lx2160a/eth_lx2160ardb.c @@ -233,7 +233,7 @@ void reset_phy(void)
static int fdt_get_dpmac_node(void *fdt, int dpmac_id) { - char dpmac_str[] = "dpmacs@00"; + char dpmac_str[11] = "dpmacs@00"; int offset, dpmacs_offset;
/* get the dpmac offset */

-----Original Message----- From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Cosmin-Florin Aluchenesei Sent: Thursday, September 2, 2021 5:19 PM To: joe.hershberger@ni.com; rfried.dev@gmail.com Cc: Ioana Ciornei ioana.ciornei@nxp.com; u-boot@lists.denx.de; Aluchenesei Cosmin-florin aluchenesei.cosmin-florin@nxp.com Subject: [PATCH] board: freescale: lx2160a: fix out of bounds write
The declaration of dpmac_str was changed in order to make the following sprintf safe: sprintf(dpmac_str, "ethernet@%x", dpmac_id).
Signed-off-by: Cosmin-Florin Aluchenesei aluchenesei.cosmin-florin@nxp.com
board/freescale/lx2160a/eth_lx2160ardb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/freescale/lx2160a/eth_lx2160ardb.c b/board/freescale/lx2160a/eth_lx2160ardb.c index 30a3af9f47..f3b33940e3 100644 --- a/board/freescale/lx2160a/eth_lx2160ardb.c +++ b/board/freescale/lx2160a/eth_lx2160ardb.c @@ -233,7 +233,7 @@ void reset_phy(void)
static int fdt_get_dpmac_node(void *fdt, int dpmac_id) {
- char dpmac_str[] = "dpmacs@00";
char dpmac_str[11] = "dpmacs@00"; int offset, dpmacs_offset;
/* get the dpmac offset */
-- 2.21.0
Not able to find base code (fdt_get_dpmac_node function) for this in upstream u-boot. IS it applicable there?
Regards Priyanka
participants (2)
-
Cosmin-Florin Aluchenesei
-
Priyanka Jain (OSS)