aboot: lib: platform: Fix for banned apis
Use
* snprintf instead of sprintf
* strtok_r instead of strtok
* strlcpy instead of strncpy
Change-Id: Ib48816439f8285f8cb44585dbb13a0cd22607a15
diff --git a/platform/msm_shared/boot_device.c b/platform/msm_shared/boot_device.c
index ac29dac..f74bdd1 100644
--- a/platform/msm_shared/boot_device.c
+++ b/platform/msm_shared/boot_device.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -76,14 +76,14 @@
{
#if !USE_MDM_BOOT_CFG
case BOOT_DEFAULT:
- sprintf(buf, "%x.sdhci", ((struct mmc_device *)dev)->host.base);
+ snprintf(buf, ((sizeof((struct mmc_device *)dev)->host.base)*2) + 7,"%x.sdhci", ((struct mmc_device *)dev)->host.base);
break;
case BOOT_UFS:
- sprintf(buf, "%x.ufshc", ((struct ufs_dev *)dev)->base);
+ snprintf(buf, ((sizeof((struct ufs_dev *)dev)->base)*2) + 7, "%x.ufshc", ((struct ufs_dev *)dev)->base);
break;
#endif
case BOOT_EMMC:
- sprintf(buf, "%x.sdhci", ((struct mmc_device *)dev)->host.base);
+ snprintf(buf, ((sizeof((struct mmc_device *)dev)->host.base)*2) + 7,"%x.sdhci", ((struct mmc_device *)dev)->host.base);
break;
default:
dprintf(CRITICAL,"ERROR: Unexpected boot_device val=%x",val);