Author: mcayland Date: Fri Apr 19 09:05:30 2013 New Revision: 1125 URL: http://tracker.coreboot.org/trac/openbios/changeset/1125
Log: SPARC32: Remove limit on kernel command line length caused by using a static buffer
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
Modified: trunk/openbios-devel/arch/sparc32/openbios.c
Modified: trunk/openbios-devel/arch/sparc32/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc32/openbios.c Fri Apr 19 09:04:40 2013 (r1124) +++ trunk/openbios-devel/arch/sparc32/openbios.c Fri Apr 19 09:05:30 2013 (r1125) @@ -835,8 +835,7 @@ static void arch_init( void ) { - static char cmdline[128]; - int size = 0; + char *cmdline; const char *kernel_cmdline; uint32_t temp; uint16_t machine_id; @@ -897,11 +896,11 @@
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'; + } else { + cmdline = strdup(""); + } qemu_cmdline = (uint32_t)cmdline;
/* Setup nvram variables */