]> git.sur5r.net Git - u-boot/commitdiff
fsl/sata: Replace sprintf() with snprintf()
authorTang Yuantian <Yuantian.Tang@freescale.com>
Wed, 6 May 2015 03:21:33 +0000 (11:21 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 28 May 2015 12:18:24 +0000 (08:18 -0400)
Function 'sprintf' does not check buffer boundaries but outputs
to the buffer of fixed size which could potentially cause buffer
overflow. Use a safer function to replace it.

Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
drivers/block/fsl_sata.c

index 71d7cec7bdd2256877105555b9e4904b1438cc93..735708aa20a74f3e70258eda7b6866453f6d1e63 100644 (file)
@@ -113,7 +113,7 @@ int init_sata(int dev)
        /* Save the private struct to block device struct */
        sata_dev_desc[dev].priv = (void *)sata;
 
-       sprintf(sata->name, "SATA%d", dev);
+       snprintf(sata->name, 12, "SATA%d", dev);
 
        /* Set the controller register base address to device struct */
        reg = (fsl_sata_reg_t *)(fsl_sata_info[dev].sata_reg_base);