Instead use strdup() so that we can dynamically allocate the string ourselves. As reported by Rob Landley rob@landley.net.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk --- openbios-devel/arch/sparc32/openbios.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/openbios-devel/arch/sparc32/openbios.c b/openbios-devel/arch/sparc32/openbios.c index 95a5d37..56bafe8 100644 --- a/openbios-devel/arch/sparc32/openbios.c +++ b/openbios-devel/arch/sparc32/openbios.c @@ -835,8 +835,7 @@ static void init_memory(void) static void arch_init( void ) { - static char cmdline[128]; - int size = 0; + char *cmdline = { '\0' }; const char *kernel_cmdline; uint32_t temp; uint16_t machine_id; @@ -897,11 +896,9 @@ arch_init( void )
kernel_cmdline = (const char *) fw_cfg_read_i32(FW_CFG_KERNEL_CMDLINE); if (kernel_cmdline) { - size = strlen(kernel_cmdline); - memcpy(cmdline, kernel_cmdline, size); + cmdline = strdup(kernel_cmdline); obp_arg.argv[1] = cmdline; } - cmdline[size] = '\0'; qemu_cmdline = (uint32_t)cmdline;
/* Setup nvram variables */