app: aboot: Modify code for dynamic allocation of target boot params

Target boot params size may vary depending on the targets, hence to
avoid buffer overflow use dynamic memory allocation approach for buffer.
And modifyweak function also.

Change-Id: Ic2f2094d080508a2b50b7f6f3b91c84fe9816905
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 759bc22..1ce77aa 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -93,7 +93,7 @@
 extern void platform_uninit(void);
 extern void target_uninit(void);
 extern int get_target_boot_params(const char *cmdline, const char *part,
-				  char *buf, int buflen);
+				  char **buf);
 
 void *info_buf;
 void write_device_info_mmc(device_info *dev);
@@ -164,7 +164,7 @@
 static unsigned page_mask = 0;
 static char ffbm_mode_string[FFBM_MODE_BUF_SIZE];
 static bool boot_into_ffbm;
-static char target_boot_params[64];
+static char *target_boot_params = NULL;
 static bool boot_reason_alarm;
 static bool devinfo_present = true;
 
@@ -302,8 +302,7 @@
 
 	if (get_target_boot_params(cmdline, boot_into_recovery ? "recoveryfs" :
 								 "system",
-				   target_boot_params,
-				   sizeof(target_boot_params)) == 0) {
+						&target_boot_params) == 0) {
 		have_target_boot_params = 1;
 		cmdline_len += strlen(target_boot_params);
 	}
@@ -516,6 +515,7 @@
 			if (have_cmdline) --dst;
 			src = target_boot_params;
 			while ((*dst++ = *src++));
+			free(target_boot_params);
 		}
 	}