target: mdm9607: Fix possible NULL pointer dereference.
Fix possible NULL pointer dereference when cmdline is not present.
Change-Id: Ib7201e08ca563c05a270751625a6bb35f3a41ac9
diff --git a/target/mdm9607/init.c b/target/mdm9607/init.c
index b59b7b9..4145588 100644
--- a/target/mdm9607/init.c
+++ b/target/mdm9607/init.c
@@ -257,6 +257,11 @@
int system_ptn_index = -1;
uint32_t buflen = strlen(UBI_CMDLINE) + strlen(" root=ubi0:rootfs ubi.mtd=") + sizeof(int) + 1; /* 1 byte for null character*/
+ if (!cmdline || !part ) {
+ dprintf(CRITICAL, "WARN: Invalid input param\n");
+ return -1;
+ }
+
*buf = (char *)malloc(buflen);
if(!(*buf)) {
dprintf(CRITICAL,"Unable to allocate memory for boot params\n");